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

Method rotate_by_list

python/singa/image_tool.py:350–375  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

348 return self.rotate_by_list(angle_list, 1, inplace)
349
350 def rotate_by_list(self, angle_list, num_case=1, inplace=True):
351 ''&#x27;
352 Args:
353 num_case: num of rotate cases, must be <= the length of angle_list
354 inplace: inplace imgs or not ( return new_imgs)
355 ''&#x27;
356 new_imgs = []
357 if num_case < 1 or num_case > len(angle_list):
358 raise Exception(
359 'num_case must be smaller in [1,%d(length of angle_list)]' %
360 len(angle_list))
361
362 for img in self.imgs:
363 if num_case == len(angle_list):
364 angles = angle_list
365 else:
366 angles = get_list_sample(angle_list, num_case)
367
368 for angle in angles:
369 new_img = img.rotate(angle)
370 new_imgs.append(new_img)
371 if inplace:
372 self.imgs = new_imgs
373 return self
374 else:
375 return new_imgs
376
377 def crop5(self, patch, num_case=1, inplace=True):
378 ''&#x27;Crop at positions from [left_top, left_bottom, right_top,

Callers 1

rotate_by_rangeMethod · 0.95

Calls 2

get_list_sampleFunction · 0.85
appendMethod · 0.80

Tested by

no test coverage detected