MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / crop

Function crop

rtpose_wrapper/python/caffe/coord_map.py:172–185  ·  view source on GitHub ↗

Define a Crop layer to crop a top (from) to another top (to) by determining the coordinate mapping between the two and net spec'ing the axis and shift parameters of the crop.

(top_from, top_to)

Source from the content-addressed store, hash-verified

170
171
172def crop(top_from, top_to):
173 """
174 Define a Crop layer to crop a top (from) to another top (to) by
175 determining the coordinate mapping between the two and net spec'ing
176 the axis and shift parameters of the crop.
177 """
178 ax, a, b = coord_map_from_to(top_from, top_to)
179 assert (a == 1).all(), 'scale mismatch on crop (a = {})'.format(a)
180 assert (b <= 0).all(), 'cannot crop negative offset (b = {})'.format(b)
181 assert (np.round(b) == b).all(), 'cannot crop noninteger offset ' \
182 '(b = {})'.format(b)
183 return L.Crop(top_from, top_to,
184 crop_param=dict(axis=ax + 1, # +1 for first cropping dim.
185 offset=list(-np.round(b).astype(int))))

Callers 3

test_crop_helperMethod · 0.90

Calls 2

coord_map_from_toFunction · 0.85
listClass · 0.85

Tested by 3

test_crop_helperMethod · 0.72