microsoft / microsoft/onnxruntime-inference-examples

Using the yolov3 get_prediction_evaluation_yolov3_variant throws an exception.

Open
#248 6 comments 0 reactions 1 assignee View on GitHub

@chilo-ms is already working on this.

Since Jun 7, 2023.

Dominant language
C++
Stars
1.7k
Forks
414
Avg merge
1d 6h
Merged PRs (30d)
14

Description

Finding optimal threshold for each tensor using entropy algorithm ...
Number of tensors : 397
Number of histogram bins : 128 (The number may increase depends on the data it collects)
Number of quantized bins : 128
Traceback (most recent call last):
File "e2e_user_yolov3_example.py", line 241, in
get_calibration_table_tofa(model_path, augmented_model_path, calibration_dataset)
File "e2e_user_yolov3_example.py", line 175, in get_prediction_evaluation_yolov3_variant
write_calibration_table(calibrator.compute_range())
File "/home/lbathen/miniconda3/envs/onnx/lib/python3.8/site-packages/onnxruntime/quantization/quant_utils.py", line 409, in write_calibration_table
file.write(json.dumps(calibration_cache)) # use json.loads to do the reverse
File "/home/lbathen/miniconda3/envs/onnx/lib/python3.8/json/init.py", line 231, in dumps
return _default_encoder.encode(obj)
File "/home/lbathen/miniconda3/envs/onnx/lib/python3.8/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/home/lbathen/miniconda3/envs/onnx/lib/python3.8/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/home/lbathen/miniconda3/envs/onnx/lib/python3.8/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.class.name} '
TypeError: Object of type float32 is not JSON serializable

--- To reproduce, download and use a different variant of Yolo, and use the get_prediction_evaluation_yolov3_variant method...

onnx==1.14.0
onnxruntime-gpu==1.14.1
cuda 12.1
ubuntu 20.04

---- Reproducible on two separate machines... ubuntu 20 and 22...

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.