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

Commit

Permalink
Reuse code in blob.py to fix inconsistent sizes in FPN's sum
Browse files Browse the repository at this point in the history
  • Loading branch information
daquexian committed May 15, 2018
1 parent 78c29fc commit 27f5aee
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tools/convert_pkl_to_pb.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
from detectron.utils.logging import setup_logging
from detectron.utils.model_convert_utils import convert_op_in_proto
from detectron.utils.model_convert_utils import op_filter
import detectron.utils.blob as blob_utils
import detectron.core.test_engine as test_engine
import detectron.utils.c2 as c2_utils
import detectron.utils.model_convert_utils as mutils
Expand Down Expand Up @@ -485,10 +486,8 @@ def _prepare_blobs(
im = cv2.resize(im, None, None, fx=im_scale, fy=im_scale,
interpolation=cv2.INTER_LINEAR)

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

blobs = {}
blobs['data'] = blob
Expand Down

0 comments on commit 27f5aee

Please sign in to comment.