Skip to content
This repository was archived by the owner on Nov 21, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion detectron/ops/zero_even_op.cu
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ template <>
bool ZeroEvenOp<float, CUDAContext>::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);
Expand Down
3 changes: 1 addition & 2 deletions detectron/roi_data/fast_rcnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions detectron/tests/test_zero_even_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down
10 changes: 5 additions & 5 deletions detectron/utils/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down