diff --git a/detectron/ops/zero_even_op.cu b/detectron/ops/zero_even_op.cu index a606727d9..c2e5b833f 100644 --- a/detectron/ops/zero_even_op.cu +++ b/detectron/ops/zero_even_op.cu @@ -35,7 +35,7 @@ template <> bool ZeroEvenOp::RunOnDevice() { // Retrieve the input tensor. const auto& X = Input(0); - CAFFE_ENFORCE(X.ndim() == 1); + CAFFE_ENFORCE(X.dim() == 1); // Initialize the output tensor to a copy of the input tensor. auto* Y = Output(0); diff --git a/detectron/roi_data/fast_rcnn.py b/detectron/roi_data/fast_rcnn.py index 56e96987b..a9f4cb381 100644 --- a/detectron/roi_data/fast_rcnn.py +++ b/detectron/roi_data/fast_rcnn.py @@ -47,7 +47,6 @@ def get_fast_rcnn_blob_names(is_training=True): # labels_int32 blob: R categorical labels in [0, ..., K] for K # foreground classes plus background blob_names += ['labels_int32'] - if is_training: # bbox_targets blob: R bounding-box regression targets with 4 # targets per class blob_names += ['bbox_targets'] @@ -157,7 +156,7 @@ def _sample_rois(roidb, im_scale, batch_idx): # against there being fewer than desired) bg_rois_per_this_image = rois_per_image - fg_rois_per_this_image bg_rois_per_this_image = np.minimum(bg_rois_per_this_image, bg_inds.size) - # Sample foreground regions without replacement + # Sample background regions without replacement if bg_inds.size > 0: bg_inds = npr.choice( bg_inds, size=bg_rois_per_this_image, replace=False diff --git a/detectron/tests/test_zero_even_op.py b/detectron/tests/test_zero_even_op.py index 82076a8a9..bd2ca4526 100644 --- a/detectron/tests/test_zero_even_op.py +++ b/detectron/tests/test_zero_even_op.py @@ -47,7 +47,7 @@ def _run_zero_even_op_gpu(self, X): def test_throws_on_non_1D_arrays(self): X = np.zeros((2, 2), dtype=np.float32) - with self.assertRaisesRegexp(RuntimeError, 'X\.ndim\(\) == 1'): + with self.assertRaisesRegexp(RuntimeError, 'X\.dim\(\) == 1'): self._run_zero_even_op(X) def test_handles_empty_arrays(self): @@ -84,7 +84,7 @@ def test_handles_odd_length_arrays(self): def test_gpu_throws_on_non_1D_arrays(self): X = np.zeros((2, 2), dtype=np.float32) - with self.assertRaisesRegexp(RuntimeError, 'X\.ndim\(\) == 1'): + with self.assertRaisesRegexp(RuntimeError, 'X\.dim\(\) == 1'): self._run_zero_even_op_gpu(X) def test_gpu_handles_empty_arrays(self): diff --git a/detectron/utils/io.py b/detectron/utils/io.py index 4501b0a3f..946bd6d6d 100644 --- a/detectron/utils/io.py +++ b/detectron/utils/io.py @@ -39,11 +39,11 @@ def save_object(obj, file_name, pickle_format=2): """Save a Python object by pickling it. -Unless specifically overridden, we want to save it in Pickle format=2 since this -will allow other Python2 executables to load the resulting Pickle. When we want -to completely remove Python2 backward-compatibility, we can bump it up to 3. We -should never use pickle.HIGHEST_PROTOCOL as far as possible if the resulting -file is manifested or used, external to the system. + Unless specifically overridden, we want to save it in Pickle format=2 since this + will allow other Python2 executables to load the resulting Pickle. When we want + to completely remove Python2 backward-compatibility, we can bump it up to 3. We + should never use pickle.HIGHEST_PROTOCOL as far as possible if the resulting + file is manifested or used, external to the system. """ file_name = os.path.abspath(file_name) # Avoid filesystem race conditions (particularly on network filesystems)