Skip to content

Commit

Permalink
img_scale param
Browse files Browse the repository at this point in the history
  • Loading branch information
ccanamero committed Aug 20, 2024
1 parent 521c164 commit 9e55795
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions mmcls/datasets/pipelines/manage_multichannel_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
from .auto_augment import Brightness
from .transforms import Resize, Normalize
from .loading import LoadImageFromFile
from skimage import io, transform

from . import transforms


_MAX_LEVEL = 10
Expand Down Expand Up @@ -88,18 +91,16 @@ def __repr__(self):
)
return repr_str






@PIPELINES.register_module()
class ResizeMultiChannel(Resize):
class ResizeMultiChannel(transforms.Resize):
def _resize_img(self, results):

img = results["img"].shape
img_shape = results["img"].shape
img = transform.resize(results["img"], self.img_scale[0])

w_scale = img.shape[1]
h_scale = img.shape[2]
w_scale = img.shape[1] / img_shape[1]
h_scale = img.shape[2] / img_shape[2]

scale_factor = np.array([w_scale, h_scale, w_scale, h_scale], dtype=np.float32)
results["img"] = img
Expand All @@ -108,6 +109,7 @@ def _resize_img(self, results):
results["scale_factor"] = scale_factor
results["keep_ratio"] = self.keep_ratio


@PIPELINES.register_module()
class BrightnessTransformMultiChannel(Brightness):

Expand Down

0 comments on commit 9e55795

Please sign in to comment.