Skip to content
This repository has been archived by the owner on Nov 21, 2023. It is now read-only.

use opencv instead of numpy to subtract pixel means #50

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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/utils/blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def prep_im_for_blob(im, pixel_means, target_size, max_size):
the scale factors that were used to compute each returned image.
"""
im = im.astype(np.float32, copy=False)
im -= pixel_means
im = cv2.subtract(im, pixel_means.reshape((1,) + im.shape[-1:]))
im_shape = im.shape
im_size_min = np.min(im_shape[0:2])
im_size_max = np.max(im_shape[0:2])
Expand Down