Skip to content

Commit 0d05dd5

Browse files
author
Adam Wawrzyński
committed
Add example config.pbtxt for ONNX, fix preprocessing data
Signed-off-by: Adam Wawrzyński <adam.wawrzynski@reasonfieldlab.com>
1 parent d8c8ea2 commit 0d05dd5

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

Quick_Deploy/ONNX/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def rn50_preprocess(img_path="img1.jpg"):
3939
transforms.ToTensor(),
4040
transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
4141
])
42-
return np.expand_dims(preprocess(img).numpy(),axis=0)
42+
return np.expand_dims(preprocess(img).numpy(), axis=0).squeeze()
4343

4444
transformed_img = rn50_preprocess()
4545

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Copyright 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
#
3+
# Redistribution and use in source and binary forms, with or without
4+
# modification, are permitted provided that the following conditions
5+
# are met:
6+
# * Redistributions of source code must retain the above copyright
7+
# notice, this list of conditions and the following disclaimer.
8+
# * Redistributions in binary form must reproduce the above copyright
9+
# notice, this list of conditions and the following disclaimer in the
10+
# documentation and/or other materials provided with the distribution.
11+
# * Neither the name of NVIDIA CORPORATION nor the names of its
12+
# contributors may be used to endorse or promote products derived
13+
# from this software without specific prior written permission.
14+
#
15+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
16+
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18+
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
19+
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20+
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21+
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23+
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26+
27+
name: "densenet_onnx"
28+
platform: "onnxruntime_onnx"
29+
max_batch_size : 0
30+
input [
31+
{
32+
name: "data_0"
33+
data_type: TYPE_FP32
34+
dims: [ 3, 224, 224 ]
35+
reshape { shape: [ 1, 3, 224, 224 ] }
36+
}
37+
]
38+
output [
39+
{
40+
name: "fc6_1"
41+
data_type: TYPE_FP32
42+
dims: [ 1, 1000 ,1, 1]
43+
}
44+
]

0 commit comments

Comments
 (0)