summaryrefslogtreecommitdiff
path: root/python/detect.py
diff options
context:
space:
mode:
authorEvan Shelhamer <shelhamer@imaginarynumber.net>2014-06-08 20:31:35 -0700
committerEvan Shelhamer <shelhamer@imaginarynumber.net>2014-06-09 18:14:25 -0700
commit4992abecec7214bce3c07497438c2e1ff963e657 (patch)
tree3d23c4c2ca994ba9e42febdaf46f495f52d6b020 /python/detect.py
parenta57b8d5b4093b7bdba9f02b278b9823c290a0b7d (diff)
downloadcaffeonacl-4992abecec7214bce3c07497438c2e1ff963e657.tar.gz
caffeonacl-4992abecec7214bce3c07497438c2e1ff963e657.tar.bz2
caffeonacl-4992abecec7214bce3c07497438c2e1ff963e657.zip
pycaffe Detector crops with surrounding context
- caffe.Detector learned how to crop windows with context in the R-CNN style s.t. the bordero of the network input is a given amount of context. - add --context_pad arg to detect.py for amount of context. Default is 16, as in R-CNN.
Diffstat (limited to 'python/detect.py')
-rwxr-xr-xpython/detect.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/python/detect.py b/python/detect.py
index 05b52449..a3bee5c5 100755
--- a/python/detect.py
+++ b/python/detect.py
@@ -86,6 +86,12 @@ def main(argv):
"RGB -> BGR since BGR is the Caffe default by way of OpenCV."
)
+ parser.add_argument(
+ "--context_pad",
+ type=int,
+ default='16',
+ help="Amount of surrounding context to collect in input window."
+ )
args = parser.parse_args()
channel_swap = [int(s) for s in args.channel_swap.split(',')]
@@ -93,7 +99,8 @@ def main(argv):
# Make detector.
detector = caffe.Detector(args.model_def, args.pretrained_model,
gpu=args.gpu, mean_file=args.mean_file,
- input_scale=args.input_scale, channel_swap=channel_swap)
+ input_scale=args.input_scale, channel_swap=channel_swap,
+ context_pad=args.context_pad)
if args.gpu:
print 'GPU mode'