未验证 提交 3d30298a 编写于 作者: Y Yuantao Feng 提交者: GitHub

add palm detector from mediapipe (#51)

上级 e1884089
......@@ -23,12 +23,15 @@ Guidelines:
| [CRNN-EN](./models/text_recognition_crnn) | 100x32 | 50.21 | 234.32 | 196.15 | 125.30 | --- |
| [CRNN-CN](./models/text_recognition_crnn) | 100x32 | 73.52 | 322.16 | 239.76 | 166.79 | --- |
| [PP-ResNet](./models/image_classification_ppresnet) | 224x224 | 56.05 | 602.58 | 98.64 | 75.45 | --- |
| [MobileNet-V1](./models/image_classification_mobilenet)| 224x224 | 9.04 | 92.25 | 33.18 | 145.66 (per-channel) | --- |
| [MobileNet-V2](./models/image_classification_mobilenet)| 224x224 | 8.86 | 74.03 | 31.92 | 146.31 (per-channel) | --- |
| [MobileNet-V1](./models/image_classification_mobilenet)| 224x224 | 9.04 | 92.25 | 33.18 | 145.66\* | --- |
| [MobileNet-V2](./models/image_classification_mobilenet)| 224x224 | 8.86 | 74.03 | 31.92 | 146.31\* | --- |
| [PP-HumanSeg](./models/human_segmentation_pphumanseg) | 192x192 | 19.92 | 105.32 | 67.97 | 74.77 | --- |
| [WeChatQRCode](./models/qrcode_wechatqrcode) | 100x100 | 7.04 | 37.68 | --- | --- | --- |
| [DaSiamRPN](./models/object_tracking_dasiamrpn) | 1280x720 | 36.15 | 705.48 | 76.82 | --- | --- |
| [YoutuReID](./models/person_reid_youtureid) | 128x256 | 35.81 | 521.98 | 90.07 | 44.61 | --- |
| [MPPalmDet](./models/palm_detection_mediapipe) | 256x256 | 15.57 | 89.41 | 50.64 | 145.56\* | --- |
\*: Models are quantized in per-channel mode, which run slower than per-tensor quantized models on NPU.
Hardware Setup:
- `INTEL-CPU`: [Intel Core i7-5930K](https://www.intel.com/content/www/us/en/products/sku/82931/intel-core-i75930k-processor-15m-cache-up-to-3-70-ghz/specifications.html) @ 3.50GHz, 6 cores, 12 threads.
......
Benchmark:
name: "Palm Detection Benchmark"
type: "Detection"
data:
path: "benchmark/data/palm_detection"
files: ["palm1.jpg", "palm2.jpg", "palm3.jpg"]
sizes: # [[w1, h1], ...], Omit to run at original scale
- [256, 256]
metric:
warmup: 30
repeat: 10
reduction: "median"
backend: "default"
target: "cpu"
Model:
name: "MPPalmDet"
modelPath: "models/palm_detection_mediapipe/palm_detection_mediapipe_2022may.onnx"
scoreThreshold: 0.5
nmsThreshold: 0.3
......@@ -196,7 +196,11 @@ data_downloaders = dict(
person_reid=Downloader(name='person_reid',
url='https://drive.google.com/u/0/uc?id=1G8FkfVo5qcuyMkjSs4EA6J5e16SWDGI2&export=download',
sha='5b741fbf34c1fbcf59cad8f2a65327a5899e66f1',
filename='person_reid.zip')
filename='person_reid.zip'),
palm_detection=Downloader(name='palm_detection',
url='https://drive.google.com/u/0/uc?id=1qScOzehV8OIzJJLuD_LMvZq15YcWd_VV&export=download',
sha='c0d4f811d38c6f833364b9196a719307598213a1',
filename='palm_detection.zip'),
)
if __name__ == '__main__':
......@@ -214,4 +218,4 @@ if __name__ == '__main__':
download_failed.append(downloader._name)
if download_failed:
print('Data have not been downloaded: {}'.format(str(download_failed)))
\ No newline at end of file
print('Data have not been downloaded: {}'.format(str(download_failed)))
......@@ -9,6 +9,7 @@ from .object_tracking_dasiamrpn.dasiamrpn import DaSiamRPN
from .person_reid_youtureid.youtureid import YoutuReID
from .image_classification_mobilenet.mobilenet_v1 import MobileNetV1
from .image_classification_mobilenet.mobilenet_v2 import MobileNetV2
from .palm_detection_mediapipe.mp_palmdet import MPPalmDet
class Registery:
def __init__(self, name):
......@@ -33,4 +34,5 @@ MODELS.register(DaSiamRPN)
MODELS.register(YoutuReID)
MODELS.register(MobileNetV1)
MODELS.register(MobileNetV2)
MODELS.register(MPPalmDet)
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
# Palm detector from MediaPipe Handpose
This model detects palm bounding boxes and palm landmarks, and is converted from Tensorflow-JS to ONNX using following tools:
- tfjs to tf_saved_model: https://github.com/patlevin/tfjs-to-tf/
- tf_saved_model to ONNX: https://github.com/onnx/tensorflow-onnx
- simplified by [onnx-simplifier](https://github.com/daquexian/onnx-simplifier)
Also note that the model is quantized in per-channel mode with [Intel's neural compressor](https://github.com/intel/neural-compressor), which gives better accuracy but may lose some speed.
## Demo
Run the following commands to try the demo:
```bash
# detect on camera input
python demo.py
# detect on an image
python demo.py -i /path/to/image
```
NOTE: For the quantized model, you will need to install OpenCV 4.6.0 to have asymmetric paddings support for quantized convolution layer in OpenCV. Score threshold needs to be adjusted as well for the quantized model, which is empirically 0.49.
## License
All files in this directory are licensed under [Apache 2.0 License](./LICENSE).
## Reference
- MediaPipe Handpose: https://github.com/tensorflow/tfjs-models/tree/master/handpose
import argparse
import numpy as np
import cv2 as cv
from mp_palmdet import MPPalmDet
def str2bool(v):
if v.lower() in ['on', 'yes', 'true', 'y', 't']:
return True
elif v.lower() in ['off', 'no', 'false', 'n', 'f']:
return False
else:
raise NotImplementedError
backends = [cv.dnn.DNN_BACKEND_OPENCV, cv.dnn.DNN_BACKEND_CUDA]
targets = [cv.dnn.DNN_TARGET_CPU, cv.dnn.DNN_TARGET_CUDA, cv.dnn.DNN_TARGET_CUDA_FP16]
help_msg_backends = "Choose one of the computation backends: {:d}: OpenCV implementation (default); {:d}: CUDA"
help_msg_targets = "Chose one of the target computation devices: {:d}: CPU (default); {:d}: CUDA; {:d}: CUDA fp16"
try:
backends += [cv.dnn.DNN_BACKEND_TIMVX]
targets += [cv.dnn.DNN_TARGET_NPU]
help_msg_backends += "; {:d}: TIMVX"
help_msg_targets += "; {:d}: NPU"
except:
print('This version of OpenCV does not support TIM-VX and NPU. Visit https://gist.github.com/fengyuentau/5a7a5ba36328f2b763aea026c43fa45f for more information.')
parser = argparse.ArgumentParser(description='Hand Detector from MediaPipe')
parser.add_argument('--input', '-i', type=str, help='Path to the input image. Omit for using default camera.')
parser.add_argument('--model', '-m', type=str, default='./palm_detection_mediapipe_2022may.onnx', help='Path to the model.')
parser.add_argument('--backend', '-b', type=int, default=backends[0], help=help_msg_backends.format(*backends))
parser.add_argument('--target', '-t', type=int, default=targets[0], help=help_msg_targets.format(*targets))
parser.add_argument('--score_threshold', type=float, default=0.99, help='Filter out faces of confidence < conf_threshold. An empirical score threshold for the quantized model is 0.49.')
parser.add_argument('--nms_threshold', type=float, default=0.3, help='Suppress bounding boxes of iou >= nms_threshold.')
parser.add_argument('--save', '-s', type=str, default=False, help='Set true to save results. This flag is invalid when using camera.')
parser.add_argument('--vis', '-v', type=str2bool, default=True, help='Set true to open a window for result visualization. This flag is invalid when using camera.')
args = parser.parse_args()
def visualize(image, score, palm_box, palm_landmarks, fps=None):
output = image.copy()
if fps is not None:
cv.putText(output, 'FPS: {:.2f}'.format(fps), (0, 15), cv.FONT_HERSHEY_SIMPLEX, 0.5, (0, 0, 255))
# put score
palm_box = palm_box.astype(np.int32)
cv.putText(output, '{:.4f}'.format(score), (palm_box[0], palm_box[1]+12), cv.FONT_HERSHEY_DUPLEX, 0.5, (0, 255, 0))
# draw box
cv.rectangle(output, (palm_box[0], palm_box[1]), (palm_box[2], palm_box[3]), (0, 255, 0), 2)
# draw points
palm_landmarks = palm_landmarks.astype(np.int32)
for p in palm_landmarks:
cv.circle(output, p, 2, (0, 0, 255), 2)
return output
if __name__ == '__main__':
# Instantiate MPPalmDet
model = MPPalmDet(modelPath=args.model,
nmsThreshold=args.nms_threshold,
scoreThreshold=args.score_threshold,
backendId=args.backend,
targetId=args.target)
# If input is an image
if args.input is not None:
image = cv.imread(args.input)
# Inference
score, palm_box, palm_landmarks = model.infer(image)
if score is None or palm_box is None or palm_landmarks is None:
print('Hand not detected')
else:
# Print results
print('score: {:.2f}'.format(score))
print('palm box: {}'.format(palm_box))
print('palm_landmarks: ')
for plm in enumerate(palm_landmarks):
print('\t{}'.format(plm))
# Draw results on the input image
image = visualize(image, score, palm_box, palm_landmarks)
# Save results if save is true
if args.save:
print('Resutls saved to result.jpg\n')
cv.imwrite('result.jpg', image)
# Visualize results in a new window
if args.vis:
cv.namedWindow(args.input, cv.WINDOW_AUTOSIZE)
cv.imshow(args.input, image)
cv.waitKey(0)
else: # Omit input to call default camera
deviceId = 0
cap = cv.VideoCapture(deviceId)
tm = cv.TickMeter()
while cv.waitKey(1) < 0:
hasFrame, frame = cap.read()
if not hasFrame:
print('No frames grabbed!')
break
# Inference
tm.start()
score, palm_box, palm_landmarks = model.infer(frame)
tm.stop()
# Draw results on the input image
if score is not None and palm_box is not None and palm_landmarks is not None:
frame = visualize(frame, score, palm_box, palm_landmarks, fps=tm.getFPS())
# Visualize results in a new Window
cv.imshow('MPPalmDet Demo', frame)
tm.reset()
此差异已折叠。
......@@ -11,21 +11,24 @@ pip install -r requirements.txt
Quantize all models in the Zoo:
```shell
python quantize.py
python quantize-ort.py
python quantize-inc.py
```
Quantize one of the models in the Zoo:
```shell
# python quantize.py <key_in_models>
python quantize.py yunet
python quantize-ort.py yunet
python quantize-inc.py mobilenetv1
```
Customizing quantization configs:
```python
# add model into `models` dict in quantize.py
# Quantize with ONNXRUNTIME
# 1. add your model into `models` dict in quantize-ort.py
models = dict(
# ...
model1=Quantize(model_path='/path/to/model1.onnx'
model1=Quantize(model_path='/path/to/model1.onnx',
calibration_image_dir='/path/to/images',
transforms=Compose([''' transforms ''']), # transforms can be found in transforms.py
per_channel=False, # set False to quantize in per-tensor style
......@@ -33,6 +36,18 @@ models = dict(
wt_type='int8' # available types: 'int8', 'uint8'
)
)
# quantize the added models
python quantize.py model1
# 2. quantize your model
python quantize-ort.py model1
# Quantize with Intel Neural Compressor
# 1. add your model into `models` dict in quantize-inc.py
models = dict(
# ...
model1=Quantize(model_path='/path/to/model1.onnx',
config_path='/path/to/model1.yaml'),
)
# 2. prepare your YAML config model1.yaml (see configs in ./inc_configs)
# 3. quantize your model
python quantize-inc.py model1
```
import os
import sys
import numpy as ny
import cv2 as cv
import onnx
from neural_compressor.experimental import Quantization, common as nc_Quantization, nc_common
class Quantize:
def __init__(self, model_path, config_path, custom_dataset=None):
self.model_path = model_path
self.config_path = config_path
self.custom_dataset = custom_dataset
def run(self):
print('Quantizing (int8) with Intel\'s Neural Compressor:')
print('\tModel: {}'.format(self.model_path))
print('\tConfig: {}'.format(self.config_path))
output_name = '{}-int8-quantized.onnx'.format(self.model_path[:-5])
model = onnx.load(self.model_path)
quantizer = nc_Quantization(self.config_path)
if self.custom_dataset is not None:
quantizer.calib_dataloader = common.DataLoader(self.custom_dataset)
quantizer.model = common.Model(model)
q_model = quantizer()
q_model.save(output_name)
class Dataset:
def __init__(self, root):
self.root = root
self.image_list = self.load_image_list(self.root)
def load_image_list(self, path):
image_list = []
for f in os.listdir(path):
if not f.endswith('.jpg'):
continue
image_list.append(f)
return image_list
def __getitem__(self, idx):
img = cv.imread(self.image_list[idx])
return img, 1
def __len__(self):
return len(self.image_list)
models=dict(
mobilenetv1=Quantize(model_path='../../models/image_classification_mobilenet/image_classification_mobilenetv1_2022apr.onnx',
config_path='./inc_configs/mobilenet.yaml'),
mobilenetv2=Quantize(model_path='../../models/image_classification_mobilenet/image_classification_mobilenetv2_2022apr.onnx',
config_path='./inc_configs/mobilenet.yaml'),
mppalm_det=Quantize(model_path='../../models/palm_detection_mediapipe/palm_detection_mediapipe_2022may.onnx',
config_path='./inc_configs/mppalmdet.yaml',
custom_dataset=Dataset(root='../../benchmark/data/palm_detection'))
)
if __name__ == '__main__':
selected_models = []
for i in range(1, len(sys.argv)):
selected_models.append(sys.argv[i])
if not selected_models:
selected_models = list(models.keys())
print('Models to be quantized: {}'.format(str(selected_models)))
for selected_model_name in selected_models:
q = models[selected_model_name]
q.run()
......@@ -10,7 +10,6 @@ import numpy as ny
import cv2 as cv
import onnx
from neural_compressor.experimental import Quantization, common as nc_Quantization, nc_common
from onnx import version_converter
import onnxruntime
from onnxruntime.quantization import quantize_static, CalibrationDataReader, QuantType
......@@ -40,7 +39,7 @@ class DataReader(CalibrationDataReader):
blobs.append(blob)
return blobs
class ORT_Quantize:
class Quantize:
def __init__(self, model_path, calibration_image_dir, transforms=Compose(), per_channel=False, act_type='int8', wt_type='int8'):
self.type_dict = {"uint8" : QuantType.QUInt8, "int8" : QuantType.QInt8}
......@@ -78,51 +77,28 @@ class ORT_Quantize:
os.remove('{}-opt.onnx'.format(self.model_path[:-5]))
print('\tQuantized model saved to {}'.format(output_name))
class INC_Quantize:
def __init__(self, model_path, config_path):
self.model_path = model_path
self.config_path = config_path
def run(self):
print('Quantizing (int8) with Intel\'s Neural Compressor:')
print('\tModel: {}'.format(self.model_path))
print('\tConfig: {}'.format(self.config_path))
output_name = '{}-int8-quantized.onnx'.format(self.model_path[:-5])
model = onnx.load(self.model_path)
quantizer = nc_Quantization(self.config_path)
quantizer.model = common.Model(model)
q_model = quantizer()
q_model.save(output_name)
models=dict(
yunet=ORT_Quantize(model_path='../../models/face_detection_yunet/face_detection_yunet_2022mar.onnx',
yunet=Quantize(model_path='../../models/face_detection_yunet/face_detection_yunet_2022mar.onnx',
calibration_image_dir='../../benchmark/data/face_detection',
transforms=Compose([Resize(size=(160, 120))])),
sface=ORT_Quantize(model_path='../../models/face_recognition_sface/face_recognition_sface_2021dec.onnx',
sface=Quantize(model_path='../../models/face_recognition_sface/face_recognition_sface_2021dec.onnx',
calibration_image_dir='../../benchmark/data/face_recognition',
transforms=Compose([Resize(size=(112, 112))])),
pphumenseg=ORT_Quantize(model_path='../../models/human_segmentation_pphumanseg/human_segmentation_pphumanseg_2021oct.onnx',
pphumenseg=Quantize(model_path='../../models/human_segmentation_pphumanseg/human_segmentation_pphumanseg_2021oct.onnx',
calibration_image_dir='../../benchmark/data/human_segmentation',
transforms=Compose([Resize(size=(192, 192))])),
ppresnet50=ORT_Quantize(model_path='../../models/image_classification_ppresnet/image_classification_ppresnet50_2022jan.onnx',
ppresnet50=Quantize(model_path='../../models/image_classification_ppresnet/image_classification_ppresnet50_2022jan.onnx',
calibration_image_dir='../../benchmark/data/image_classification',
transforms=Compose([Resize(size=(224, 224))])),
mobilenetv1=INC_Quantize(model_path='../../models/image_classification_mobilenet/image_classification_mobilenetv1_2022apr.onnx',
config_path='./inc_configs/mobilenet.yaml'),
mobilenetv2=INC_Quantize(model_path='../../models/image_classification_mobilenet/image_classification_mobilenetv2_2022apr.onnx',
config_path='./inc_configs/mobilenet.yaml'),
# TBD: DaSiamRPN
youtureid=ORT_Quantize(model_path='../../models/person_reid_youtureid/person_reid_youtu_2021nov.onnx',
youtureid=Quantize(model_path='../../models/person_reid_youtureid/person_reid_youtu_2021nov.onnx',
calibration_image_dir='../../benchmark/data/person_reid',
transforms=Compose([Resize(size=(128, 256))])),
# TBD: DB-EN & DB-CN
crnn_en=ORT_Quantize(model_path='../../models/text_recognition_crnn/text_recognition_CRNN_EN_2021sep.onnx',
crnn_en=Quantize(model_path='../../models/text_recognition_crnn/text_recognition_CRNN_EN_2021sep.onnx',
calibration_image_dir='../../benchmark/data/text',
transforms=Compose([Resize(size=(100, 32)), ColorConvert(ctype=cv.COLOR_BGR2GRAY)])),
crnn_cn=ORT_Quantize(model_path='../../models/text_recognition_crnn/text_recognition_CRNN_CN_2021nov.onnx',
crnn_cn=Quantize(model_path='../../models/text_recognition_crnn/text_recognition_CRNN_CN_2021nov.onnx',
calibration_image_dir='../../benchmark/data/text',
transforms=Compose([Resize(size=(100, 32))]))
)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册