Commit 9ee5050e authored by haamoon's avatar haamoon Committed by Yuxin Wu

fix potential numericall error bug (#337)

* add _augment_coords implementation for many ImageAugmentor subclasses

* Fxied style issue

* Fixed style issues

* Added AugmentImageCoordinates

* Fixed stype issues

* remove unused comments

* fix potential numericall error bug
parent faf00e48
......@@ -85,8 +85,8 @@ class Resize(ImageAugmentor):
def _augment_coords(self, coords, param):
h, w = param
coords[:, 0] = coords[:, 0] * self.shape[1] * 1.0 / w
coords[:, 1] = coords[:, 1] * self.shape[0] * 1.0 / h
coords[:, 0] = coords[:, 0] * (self.shape[1] * 1.0 / w)
coords[:, 1] = coords[:, 1] * (self.shape[0] * 1.0 / h)
return coords
......@@ -119,8 +119,8 @@ class ResizeShortestEdge(ImageAugmentor):
def _augment_coords(self, coords, param):
h, w, newh, neww = param
coords[:, 0] = coords[:, 0] * neww * 1.0 / w
coords[:, 1] = coords[:, 1] * newh * 1.0 / h
coords[:, 0] = coords[:, 0] * (neww * 1.0 / w)
coords[:, 1] = coords[:, 1] * (newh * 1.0 / h)
return coords
......@@ -174,8 +174,8 @@ class RandomResize(ImageAugmentor):
def _augment_coords(self, coords, param):
h, w, newh, neww = param
coords[:, 0] = coords[:, 0] * neww * 1.0 / w
coords[:, 1] = coords[:, 1] * newh * 1.0 / h
coords[:, 0] = coords[:, 0] * (neww * 1.0 / w)
coords[:, 1] = coords[:, 1] * (newh * 1.0 / h)
return coords
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment