Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added explicit antialias=False to ensure we can export torchvision Resize to ONNX #1824

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/unit_tests/export_onnx_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
class TestModelsONNXExport(unittest.TestCase):
def test_models_onnx_export_with_deprecated_input_shape(self):
pretrained_model = models.get(Models.RESNET18, num_classes=1000, pretrained_weights="imagenet")
preprocess = Compose([Resize(224), Standardize(), Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])])
preprocess = Compose([Resize(224, antialias=False), Standardize(), Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])])
with tempfile.TemporaryDirectory() as tmpdirname:
out_path = os.path.join(tmpdirname, "resnet18.onnx")
models.convert_to_onnx(model=pretrained_model, out_path=out_path, input_shape=(3, 256, 256), pre_process=preprocess)
self.assertTrue(os.path.exists(out_path))

def test_models_onnx_export(self):
pretrained_model = models.get(Models.RESNET18, num_classes=1000, pretrained_weights="imagenet")
preprocess = Compose([Resize(224), Standardize(), Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])])
preprocess = Compose([Resize(224, antialias=False), Standardize(), Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])])
with tempfile.TemporaryDirectory() as tmpdirname:
out_path = os.path.join(tmpdirname, "resnet18.onnx")
models.convert_to_onnx(
Expand Down
Loading