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

Commit 2624603

Browse files
committed
Reuse code in blob.py to fix inconsistent sizes in FPN's sum
1 parent ed5c07a commit 2624603

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
@@ -52,6 +52,7 @@
5252
import utils.vis as vis_utils
5353
import utils.logging
5454
import utils.model_convert_utils as mutils
55+
import utils.blob as blob_utils
5556
from utils.model_convert_utils import op_filter, convert_op_in_proto
5657

5758
c2_utils.import_contrib_ops()
@@ -480,10 +481,8 @@ def _prepare_blobs(
480481
im = cv2.resize(im, None, None, fx=im_scale, fy=im_scale,
481482
interpolation=cv2.INTER_LINEAR)
482483

483-
blob = np.zeros([1, im.shape[0], im.shape[1], 3], dtype=np.float32)
484-
blob[0, :, :, :] = im
485-
channel_swap = (0, 3, 1, 2) # swap channel to (k, c, h, w)
486-
blob = blob.transpose(channel_swap)
484+
# Reuse code in blob_utils and fit FPN
485+
blob = blob_utils.im_list_to_blob([im])
487486

488487
blobs = {}
489488
blobs['data'] = blob

0 commit comments

Comments
 (0)