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

Commit 27f5aee

Browse files
committed
Reuse code in blob.py to fix inconsistent sizes in FPN's sum
1 parent 78c29fc commit 27f5aee

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

tools/convert_pkl_to_pb.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
from detectron.utils.logging import setup_logging
5151
from detectron.utils.model_convert_utils import convert_op_in_proto
5252
from detectron.utils.model_convert_utils import op_filter
53+
import detectron.utils.blob as blob_utils
5354
import detectron.core.test_engine as test_engine
5455
import detectron.utils.c2 as c2_utils
5556
import detectron.utils.model_convert_utils as mutils
@@ -485,10 +486,8 @@ def _prepare_blobs(
485486
im = cv2.resize(im, None, None, fx=im_scale, fy=im_scale,
486487
interpolation=cv2.INTER_LINEAR)
487488

488-
blob = np.zeros([1, im.shape[0], im.shape[1], 3], dtype=np.float32)
489-
blob[0, :, :, :] = im
490-
channel_swap = (0, 3, 1, 2) # swap channel to (k, c, h, w)
491-
blob = blob.transpose(channel_swap)
489+
# Reuse code in blob_utils and fit FPN
490+
blob = blob_utils.im_list_to_blob([im])
492491

493492
blobs = {}
494493
blobs['data'] = blob

0 commit comments

Comments
 (0)