IrDIE / YOLO8_quantization

MIT License
16 stars 1 forks source link

FileNotFoundError: [Errno 2] No such file or directory: './graph/dump/graph_model.dot' #1

Closed Ghezzo98 closed 5 months ago

Ghezzo98 commented 5 months ago

I did everything written in the Read.me, I run quantize.py and i got this error. FileNotFoundError: [Errno 2] No such file or directory: './graph/dump/graph_model.dot'

what should i do?

IrDIE commented 5 months ago

@Ghezzo98 Hi, yes, that error appear if you dont have './graph/dump/' folder. Fixed now. You can git pullnew version of that repo and run quantize.py If you still face problems feel free to ask ❤️

Ghezzo98 commented 5 months ago

Thank you! just did it. Now i have a different error :')

2024-05-13 15:06:50.860867: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:9261] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered 2024-05-13 15:06:50.860919: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:607] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered 2024-05-13 15:06:50.981703: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1515] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xf RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xf RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xf Traceback (most recent call last): . . . . . . . File "/usr/local/lib/python3.10/dist-packages/tensorflow/python/training/py_checkpoint_reader.py", line 19, in from tensorflow.python.util._pywrap_checkpoint_reader import CheckpointReader SystemError: initialization of _pywrap_checkpoint_reader raised unreported exception

Could it be the numpy version inside the requirements is not updated?

If you need the entire traceback, or some other info, just ask me. Thank you.

IrDIE commented 5 months ago

@Ghezzo98 Yes, probably its numpy version error Try numpy==1.26.4

If you still get error give entire traceback

IrDIE commented 5 months ago

@Ghezzo98 Is it works fine now?

PS saw your comment about ton of layers saved to .dot file Usually we wanna add in ignored scope heads (in yolo8 = 3 DetectionHeads) of detection model. (For yolo8 it is 22's layers - as in example)

Ghezzo98 commented 5 months ago

yeah my last question was kind dumb, i was thinking about another thing... Btw, now i have a problem running those lines of code " from ultralytics.utils import DEFAULT_CFG args = get_cfg(cfg=DEFAULT_CFG) " and i get this error: NameError: name 'get_cfg' is not defined to solve this, i run "from ultralytics.cfg import get_cfg"

another error was the "compare_accuracy" function, i can't find it. so insted i did: " from utils import * get_accuracy(...) " now it's running, I'll tell you if it is gonna work out.

last question, so to run properly the quantization in Yolo8 (medium size) i have to leave unchanged your ignored_scope(?) Thank you.

Ghezzo98 commented 5 months ago

Yeah, it worked out. Thank you! Is it possible to do inference with the quantized model?

IrDIE commented 5 months ago

@Ghezzo98 Yes, why not? that's the whole point of quantisation - to faster your inference pipeline

close this topic since no more issue

Ghezzo98 commented 5 months ago

yeah but i'm trying and i haven't managed to do it yet.

i tried with the classic approach: " from ultralytics import YOLO model=YOLO('/content/drive/MyDrive/quant_prova1/YOLO8_quantization/quantization_OpenVino/quantized_res/best_noAC_openvino_int8_model/best_noAC.bin')

model.predict('/content/drive/MyDrive/quant_prova1/YOLO8_quantization/quantization_OpenVino/foto_prova' , save = True , save_txt = True) "

And i get: " TypeError: unsupported operand type(s) for &=: 'bool' and 'str' "

IrDIE commented 5 months ago

@Ghezzo98 First of all read docs - https://docs.ultralytics.com/integrations/openvino/ You need to pass path not to .bin but to folder that contain .bin

If you still face problems - open another issue