Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
vision
Commits
e337103f
Unverified
Commit
e337103f
authored
Dec 10, 2020
by
David Fan
Committed by
GitHub
Dec 10, 2020
Browse files
Enable ONNX test in circle CI (#3144)
* Enable ONNX test in circle CI
parent
25e2085e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
9 deletions
+43
-9
.circleci/config.yml
.circleci/config.yml
+17
-0
.circleci/config.yml.in
.circleci/config.yml.in
+17
-0
test/test_onnx.py
test/test_onnx.py
+9
-9
No files found.
.circleci/config.yml
View file @
e337103f
...
...
@@ -145,6 +145,21 @@ jobs:
pip install --user --progress-bar off --editable .
python test/test_hub.py
torch_onnx_test
:
docker
:
-
image
:
circleci/python:3.7
steps
:
-
checkout
-
run
:
command
:
|
pip install --user --progress-bar off numpy
pip install --user --progress-bar off --pre torch -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
# need to install torchvision dependencies due to transitive imports
pip install --user --progress-bar off --editable .
pip install --user onnx
pip install --user -i https://test.pypi.org/simple/ ort-nightly==1.5.2.dev202012031
python test/test_onnx.py
binary_linux_wheel
:
<<
:
*binary_common
docker
:
...
...
@@ -1074,6 +1089,7 @@ workflows:
-
python_type_check
-
clang_format
-
torchhub_test
-
torch_onnx_test
unittest
:
jobs
:
...
...
@@ -1189,6 +1205,7 @@ workflows:
-
python_type_check
-
clang_format
-
torchhub_test
-
torch_onnx_test
-
binary_linux_wheel
:
cu_version
:
cpu
filters
:
...
...
.circleci/config.yml.in
View file @
e337103f
...
...
@@ -145,6 +145,21 @@ jobs:
pip install --user --progress-bar off --editable .
python test/test_hub.py
torch_onnx_test:
docker:
- image: circleci/python:3.7
steps:
- checkout
- run:
command: |
pip install --user --progress-bar off numpy
pip install --user --progress-bar off --pre torch -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
# need to install torchvision dependencies due to transitive imports
pip install --user --progress-bar off --editable .
pip install --user onnx
pip install --user -i https://test.pypi.org/simple/ ort-nightly==1.5.2.dev202012031
python test/test_onnx.py
binary_linux_wheel:
<<: *binary_common
docker:
...
...
@@ -700,6 +715,7 @@ workflows:
- python_type_check
- clang_format
- torchhub_test
- torch_onnx_test
unittest:
jobs:
...
...
@@ -717,6 +733,7 @@ workflows:
- python_type_check
- clang_format
- torchhub_test
- torch_onnx_test
{{ build_workflows(prefix="nightly_", filter_branch="nightly", upload=True) }}
docker_build:
triggers:
...
...
test/test_onnx.py
View file @
e337103f
...
...
@@ -170,7 +170,7 @@ class ONNXExporterTester(unittest.TestCase):
input
=
torch
.
rand
(
3
,
10
,
20
)
input_test
=
torch
.
rand
(
3
,
100
,
150
)
self
.
run_model
(
TransformModule
(),
[(
input
,),
(
input_test
,)],
input_names
=
[
"input1"
],
dynamic_axes
=
{
"input1"
:
[
0
,
1
,
2
,
3
]})
input_names
=
[
"input1"
],
dynamic_axes
=
{
"input1"
:
[
0
,
1
,
2
]})
def
test_transform_images
(
self
):
...
...
@@ -382,12 +382,12 @@ class ONNXExporterTester(unittest.TestCase):
# Test exported model on images of different size, or dummy input
self
.
run_model
(
model
,
[(
images
,),
(
test_images
,),
(
dummy_image
,)],
input_names
=
[
"images_tensors"
],
output_names
=
[
"outputs"
],
dynamic_axes
=
{
"images_tensors"
:
[
0
,
1
,
2
,
3
],
"outputs"
:
[
0
,
1
,
2
,
3
]},
dynamic_axes
=
{
"images_tensors"
:
[
0
,
1
,
2
],
"outputs"
:
[
0
,
1
,
2
]},
tolerate_small_mismatch
=
True
)
# Test exported model for an image with no detections on other images
self
.
run_model
(
model
,
[(
dummy_image
,),
(
images
,)],
input_names
=
[
"images_tensors"
],
output_names
=
[
"outputs"
],
dynamic_axes
=
{
"images_tensors"
:
[
0
,
1
,
2
,
3
],
"outputs"
:
[
0
,
1
,
2
,
3
]},
dynamic_axes
=
{
"images_tensors"
:
[
0
,
1
,
2
],
"outputs"
:
[
0
,
1
,
2
]},
tolerate_small_mismatch
=
True
)
# Verify that paste_mask_in_image beahves the same in tracing.
...
...
@@ -434,16 +434,16 @@ class ONNXExporterTester(unittest.TestCase):
self
.
run_model
(
model
,
[(
images
,),
(
test_images
,),
(
dummy_image
,)],
input_names
=
[
"images_tensors"
],
output_names
=
[
"boxes"
,
"labels"
,
"scores"
,
"masks"
],
dynamic_axes
=
{
"images_tensors"
:
[
0
,
1
,
2
,
3
],
"boxes"
:
[
0
,
1
],
"labels"
:
[
0
],
"scores"
:
[
0
],
"masks"
:
[
0
,
1
,
2
,
3
]},
dynamic_axes
=
{
"images_tensors"
:
[
0
,
1
,
2
],
"boxes"
:
[
0
,
1
],
"labels"
:
[
0
],
"scores"
:
[
0
],
"masks"
:
[
0
,
1
,
2
]},
tolerate_small_mismatch
=
True
)
# TODO: enable this test once dynamic model export is fixed
# Test exported model for an image with no detections on other images
self
.
run_model
(
model
,
[(
dummy_image
,),
(
images
,)],
input_names
=
[
"images_tensors"
],
output_names
=
[
"boxes"
,
"labels"
,
"scores"
,
"masks"
],
dynamic_axes
=
{
"images_tensors"
:
[
0
,
1
,
2
,
3
],
"boxes"
:
[
0
,
1
],
"labels"
:
[
0
],
"scores"
:
[
0
],
"masks"
:
[
0
,
1
,
2
,
3
]},
dynamic_axes
=
{
"images_tensors"
:
[
0
,
1
,
2
],
"boxes"
:
[
0
,
1
],
"labels"
:
[
0
],
"scores"
:
[
0
],
"masks"
:
[
0
,
1
,
2
]},
tolerate_small_mismatch
=
True
)
# Verify that heatmaps_to_keypoints behaves the same in tracing.
...
...
@@ -483,13 +483,13 @@ class ONNXExporterTester(unittest.TestCase):
self
.
run_model
(
model
,
[(
images
,),
(
test_images
,),
(
dummy_images
,)],
input_names
=
[
"images_tensors"
],
output_names
=
[
"outputs1"
,
"outputs2"
,
"outputs3"
,
"outputs4"
],
dynamic_axes
=
{
"images_tensors"
:
[
0
,
1
,
2
,
3
]},
dynamic_axes
=
{
"images_tensors"
:
[
0
,
1
,
2
]},
tolerate_small_mismatch
=
True
)
self
.
run_model
(
model
,
[(
dummy_images
,),
(
test_images
,)],
input_names
=
[
"images_tensors"
],
output_names
=
[
"outputs1"
,
"outputs2"
,
"outputs3"
,
"outputs4"
],
dynamic_axes
=
{
"images_tensors"
:
[
0
,
1
,
2
,
3
]},
dynamic_axes
=
{
"images_tensors"
:
[
0
,
1
,
2
]},
tolerate_small_mismatch
=
True
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment