Skip to content

Commit

Permalink
add fix
Browse files Browse the repository at this point in the history
  • Loading branch information
eugene123tw committed Apr 3, 2024
1 parent b0c8583 commit e0c54be
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/otx/core/model/entity/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import openvino
from jsonargparse import ArgumentParser
from openvino.model_api.models import Model
from openvino.model_api.tilers import Tiler
from torch import nn

from otx.core.data.dataset.base import LabelInfo
Expand Down Expand Up @@ -463,8 +464,10 @@ def transform_fn(self, data_batch: T_OTXBatchDataEntity) -> np.array:
"""Data transform function for PTQ."""
np_data = self._customize_inputs(data_batch)
image = np_data["inputs"][0]
resized_image = self.model.resize(image, (self.model.w, self.model.h))
resized_image = self.model.input_transform(resized_image)
# NOTE: Tiler wraps the model, so we need to unwrap it to get the model
model = self.model.model if isinstance(self.model, Tiler) else self.model
resized_image = model.resize(image, (model.w, model.h))
resized_image = model.input_transform(resized_image)

Check warning on line 470 in src/otx/core/model/entity/base.py

View check run for this annotation

Codecov / codecov/patch

src/otx/core/model/entity/base.py#L468-L470

Added lines #L468 - L470 were not covered by tests
return self.model._change_layout(resized_image) # noqa: SLF001

def _read_ptq_config_from_ir(self, ov_model: Model) -> dict[str, Any]:
Expand Down

0 comments on commit e0c54be

Please sign in to comment.