From 2092fbc5b0d88a009971a79f4bfe2d066e927710 Mon Sep 17 00:00:00 2001 From: Evan Shelhamer Date: Sun, 23 Feb 2014 15:09:38 -0800 Subject: [PATCH] Properly index windows in detector list mode Fix iteration over single windows: whether one or more windows are listed for an image, generate windows as a list. --- python/caffe/detection/detector.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/python/caffe/detection/detector.py b/python/caffe/detection/detector.py index 0132b99..1dcb797 100644 --- a/python/caffe/detection/detector.py +++ b/python/caffe/detection/detector.py @@ -125,9 +125,10 @@ def _assemble_images_list(input_df): with 'image', 'window', 'filename' columns """ # unpack sequence of (image filename, windows) - windows = input_df[['ymin', 'xmin', 'ymax', 'xmax']].values + coords = ['ymin', 'xmin', 'ymax', 'xmax'] image_windows = ( - (ix, windows[input_df.index.get_loc(ix)]) for ix in input_df.index.unique() + (ix, input_df.iloc[np.where(input_df.index == ix)][coords].values) + for ix in input_df.index.unique() ) # extract windows -- 2.7.4