openvinotoolkit/nncf

AttributeError: 'list' object has no attribute 'keys' when executing yolov8_quantize_with_accuracy_control example

openvino-book opened this issue ยท 4 comments

๐Ÿ› Describe the bug

OS = Windows 11 23H2 (22631.3447)

Reproduce the error by following the yolov8_quantize_with_accuracy_control/README.md

git clone https://github.com/openvinotoolkit/nncf.git
cd nncf
pip install .
pip install -r requirements.txt
python main.py

Then get the errro as below:

File "C:\Users\OV\anaconda3\envs\ptq\Lib\site-packages\ultralytics\models\yolo\segment\val.py", line 141, in update_metrics
for k in self.stats.keys():
^^^^^^^^^^^^^^^
AttributeError: 'list' object has no attribute 'keys'

1714999187651

Environment

OS = Windows 11 23H2 (22631.3447)

git clone https://github.com/openvinotoolkit/nncf.git
cd nncf
pip install .
pip install -r requirements.txt

Minimal Reproducible Example

No response

Are you going to submit a PR?

  • Yes I'd like to help by submitting a PR!

@openvino-book just tested on master branch (commit: cf73597) and the example is working fine. Please share the commit you used or simply try again using the latest master. If the issue persists, please share the output of pip freeze, your Python* version and the nncf commit used.

image

Had this problem, guess its something with new Yolov8 versions. Fixed this by changing in main.py line 149 from:
validator.stats = []
to:
validator.stats = dict(tp=[], conf=[], pred_cls=[], target_cls=[])

@openvino-book I followed the instruction yolov8_quantize_with_accuracy_control/README.md and I can't reproduce the issues. I checked both Ubuntu and Windows.

NNCF version: 47187e5
Python: 3.9

I closed the issue. Please feel free to reopen it if it still does not work for you, and share the output of pip freeze, your python version, and the NNCF commit used.

@openvino-book I followed the instruction yolov8_quantize_with_accuracy_control/README.md and I can't reproduce the issues. I checked both Ubuntu and Windows.

NNCF version: 47187e5 Python: 3.9

I closed the issue. Please feel free to reopen it if it still does not work for you, and share the output of pip freeze, your python version, and the NNCF commit used.

Hi, @andrey-churkin:
Sure! the problem is fixed accroding to the @dxrsgn 's soluiton, to change the L149 to

validator.stats = dict(tp_m=[], tp=[], conf=[], pred_cls=[], target_cls=[])

I has submitted a PR and hope it's helpful.:)