MCPcopy Create free account
hub / github.com/apache/singa / resize_by_list

Method resize_by_list

python/singa/image_tool.py:276–300  ·  view source on GitHub ↗

Args: num_case: num of resize cases, must be <= the length of size_list inplace: inplace imgs or not ( return new_imgs)

(self, size_list, num_case=1, inplace=True)

Source from the content-addressed store, hash-verified

274 return self.resize_by_list(size_list, 1, inplace)
275
276 def resize_by_list(self, size_list, num_case=1, inplace=True):
277 ''&#x27;
278 Args:
279 num_case: num of resize cases, must be <= the length of size_list
280 inplace: inplace imgs or not ( return new_imgs)
281 ''&#x27;
282 new_imgs = []
283 if num_case < 1 or num_case > len(size_list):
284 raise Exception(
285 'num_case must be smaller in [0,%d(length of size_list)]' %
286 len(size_list))
287 for img in self.imgs:
288 if num_case == len(size_list):
289 small_sizes = size_list
290 else:
291 small_sizes = get_list_sample(size_list, num_case)
292
293 for small_size in small_sizes:
294 new_img = resize(img, small_size)
295 new_imgs.append(new_img)
296 if inplace:
297 self.imgs = new_imgs
298 return self
299 else:
300 return new_imgs
301
302 def resize_by_hw_range(self, rng, inplace=True):
303 ''&#x27;

Callers 3

scale_by_listMethod · 0.95
resize_by_rangeMethod · 0.95
image_tool.pyFile · 0.80

Calls 3

get_list_sampleFunction · 0.85
appendMethod · 0.80
resizeFunction · 0.70

Tested by

no test coverage detected