Open darnilasariaulia opened 1 year ago
You need to do
!python onnx_inference_image.py <rest of the command>
Also, onnx inference scripts take .onnx
file for --weights
and not .pth
file. You will first need to convert the weights to ONNX format using export.py
Please let me if you face any issues.
How to export to onnx inference scripts take .onnx
I'm trying to call a program to export my data using the command:
!python export.py
But I have the following problem:
usage: export. py [-h] [-w WEIGHTS] [-d DEVICE] [--data DATA] --out OUT [--width WIDTH] [--height HEIGHT] export.py: error: the following arguments are required: --out
Please, give me an example program to export .pth tp .onnx files
You can use a command similar to the following to export the model.
python export.py --weights outputs/training/fasterrcnn_resnet18_train/best_model.pth --data data_configs/coco.yaml --out model.onnx
Remember to change the --weights
and --data
according to your requirements.
I try to run the program:
!python onnx_inference_image.py --weights weights/model.onnx --input ../test/60rpm_bit
for testing the data that I have prepared in the ../test/60rpm_bit folder.
But the following error occurs:
/usr/local/lib/python3.10/dist-packages/onnxruntime/capi/onnxruntime_inference_collection.py:54: UserWarning: Specified provider 'CUDAExecutionProvider' is not in available provider names.Available providers: 'CPUExecutionProvider'
warnings. warn(
Traceback (most recently last call):
File "/content/drive/MyDrive/Faster RCNN/fasterrcnn-pytorch-training-pipeline/onnx_inference_image.py", line 189, in
Please, give solution for using testing image in folder using model .onnx
You also need to provide the path to your dataset YAML file. This is an example command in the python onnx_inference_image.py
. Please have a look at the script in the codebase in case you face argument errors.
python onnx_inference_image.py --input ../inference_data/ --weights weights/fasterrcnn_resnet18.onnx --data data_configs/voc.yaml --imgsz 640
I tried to run this program, but the program can't run or error. Please to give me using onnx_inference_image.py
I try program:
fasterrcnn_mobilenetv3_large_fpn
!onnx_inference_image.py --weights outputs/training/fasterrcnn_resnet50_fpn_2/best_model.pth --input ../test/60rpm_sedikit --no-labels
But Error: /bin/bash: onnx_inference_image.py: command not found