stefanopini / simple-HRNet

Multi-person Human Pose Estimation with HRNet in Pytorch
GNU General Public License v3.0
571 stars 106 forks source link

ValueError: not enough values to unpack (expected 7, got 6) #83

Closed PalakHarwani closed 3 years ago

PalakHarwani commented 3 years ago

Hi, thank you for your work. I was trying to run the following :

import cv2
from SimpleHRNet import SimpleHRNet

model = SimpleHRNet(48, 17, "./weights/pose_hrnet_w48_384x288.pth")
img_file = <path to image > 
image = cv2.imread(img_file, cv2.IMREAD_COLOR)
joints = model.predict(image)

However, I get the following error:

device: 'cpu'
Traceback (most recent call last):

  File "....\simple-HRNet\scripts\hrnet_to_openpose.py", line 19, in <module>
    joints = model.predict(image)

  File "....\simple-HRNet\SimpleHRNet.py", line 176, in predict
    return self._predict_single(image)

  File "....\simple-HRNet\SimpleHRNet.py", line 207, in _predict_single
    for i, (x1, y1, x2, y2, conf, cls_conf, cls_pred) in enumerate(detections):

ValueError: not enough values to unpack (expected 7, got 6)

My image consists of only one person but I wanted to use multi-person support as the person is not in the exact center in some of the images. Any help would be appreciated. Thank you!

stefanopini commented 3 years ago

Hi!

I tried to reproduce the issue, but your code works on my machine. Could you please provide some additional context? I think the issue may be related to the version of yolo, could you report the version and the weights you're currently using? Have you installed yolov3 using git submodule update --init --recursive?

Using multi-person even with only one person is definitely fine! Indeed, it often yields to better results.

PalakHarwani commented 3 years ago

Hi, I am using yolo version 3. I didn't install it using git submodule update --init --recursive but I cloned the repository from here and changed its name as mentioned in the README file. I downloaded the weights using the bash script but I'm not sure about the version. The names of the files are yolov3.weights , yolov3-tiny.weights and darknet53.conv.74.

stefanopini commented 3 years ago

Ok, that's correct.

Unfortunately, I still can't reproduce the issue. As you can see here, the output of yolo contains 7 values for each detection, but the detections you get contain only 6 values. Have you made any changes to the YOLOv3 class?

Could you please also provide the output of the command pip freeze?

moritos commented 3 years ago

hello, I have the same problem. I haven't made any changes to the YOLOv3 class.

PalakHarwani commented 3 years ago

I didn't make any changes to the YOLOv3 class. Here's the output of pip freeze :

absl-py==0.12.0
alabaster==0.7.12
appdirs==1.4.4
argh==0.26.2
astroid @ file:///C:/ci/astroid_1613500971479/work
async-generator==1.10
atomicwrites==1.4.0
attrs @ file:///tmp/build/80754af9/attrs_1604765588209/work
autopep8 @ file:///tmp/build/80754af9/autopep8_1613246362269/work
Babel @ file:///tmp/build/80754af9/babel_1607110387436/work
backcall @ file:///home/ktietz/src/ci/backcall_1611930011877/work
bcrypt @ file:///C:/ci/bcrypt_1597918112552/work
black==19.10b0
bleach @ file:///tmp/build/80754af9/bleach_1612211392645/work
brotlipy==0.7.0
cachetools==4.2.1
certifi==2020.12.5
cffi @ file:///C:/ci/cffi_1613247308275/work
chardet @ file:///C:/ci/chardet_1607706910910/work
click @ file:///home/linux1/recipes/ci/click_1610990599742/work
cloudpickle @ file:///tmp/build/80754af9/cloudpickle_1598884132938/work
colorama @ file:///tmp/build/80754af9/colorama_1607707115595/work
colorlog==4.8.0
cryptography @ file:///C:/ci/cryptography_1613401470461/work
cycler==0.10.0
cytoolz==0.11.0
dask @ file:///tmp/build/80754af9/dask-core_1613253194046/work
decorator @ file:///home/ktietz/src/ci/decorator_1611930055503/work
defusedxml @ file:///tmp/build/80754af9/defusedxml_1615228127516/work
diff-match-patch @ file:///tmp/build/80754af9/diff-match-patch_1594828741838/work
docutils==0.16
dominate==2.4.0
EasyProcess==0.3
entrypoint2==0.2.3
entrypoints==0.3
ffmpeg-python==0.2.0
flake8 @ file:///tmp/build/80754af9/flake8_1601911421857/work
future==0.18.2
google-auth==1.28.0
google-auth-oauthlib==0.4.4
grpcio==1.36.1
idna @ file:///home/linux1/recipes/ci/idna_1610986105248/work
imagecodecs @ file:///C:/ci/imagecodecs_1611243754207/work
imageio @ file:///tmp/build/80754af9/imageio_1594161405741/work
imagesize @ file:///home/ktietz/src/ci/imagesize_1611921604382/work
imgaug==0.4.0
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1602276842396/work
intervaltree @ file:///tmp/build/80754af9/intervaltree_1598376443606/work
ipykernel @ file:///C:/ci/ipykernel_1596208728219/work/dist/ipykernel-5.3.4-py3-none-any.whl
ipython @ file:///C:/ci/ipython_1614616717881/work
ipython-genutils @ file:///tmp/build/80754af9/ipython_genutils_1606773439826/work
iso-639==0.4.5
iso3166==1.0.1
isodate==0.6.0
isort @ file:///tmp/build/80754af9/isort_1612243941122/work
jedi @ file:///C:/ci/jedi_1606932641827/work
Jinja2 @ file:///tmp/build/80754af9/jinja2_1612213139570/work
joblib @ file:///tmp/build/80754af9/joblib_1613502643832/work
jsonschema @ file:///tmp/build/80754af9/jsonschema_1602607155483/work
jupyter-client @ file:///tmp/build/80754af9/jupyter_client_1601311786391/work
jupyter-core @ file:///C:/ci/jupyter_core_1612213516947/work
jupyterlab-pygments @ file:///tmp/build/80754af9/jupyterlab_pygments_1601490720602/work
keyring @ file:///C:/ci/keyring_1614630298708/work
kiwisolver @ file:///C:/ci/kiwisolver_1612282618948/work
lazy-object-proxy @ file:///C:/ci/lazy-object-proxy_1606850189121/work
Markdown==3.3.4
MarkupSafe @ file:///C:/ci/markupsafe_1594405949945/work
matplotlib @ file:///C:/ci/matplotlib-suite_1613408055530/work
mccabe==0.6.1
mistune @ file:///C:/ci/mistune_1594373272338/work
mkl-fft==1.3.0
mkl-random==1.1.1
mkl-service==2.3.0
mss==6.1.0
munkres==1.1.4
mypy-extensions==0.4.3
nbclient @ file:///tmp/build/80754af9/nbclient_1614364831625/work
nbconvert @ file:///C:/ci/nbconvert_1601914921407/work
nbformat @ file:///tmp/build/80754af9/nbformat_1610738111109/work
nest-asyncio @ file:///tmp/build/80754af9/nest-asyncio_1613680548246/work
networkx @ file:///tmp/build/80754af9/networkx_1598376031484/work
numpy @ file:///C:/ci/numpy_and_numpy_base_1603468620949/work
numpydoc @ file:///tmp/build/80754af9/numpydoc_1605117425582/work
oauthlib==3.1.0
olefile==0.46
opencv-python==4.5.1.48
packaging @ file:///tmp/build/80754af9/packaging_1611952188834/work
pafy==0.5.5
pandas @ file:///C:/ci/pandas_1614711338358/work
pandocfilters @ file:///C:/ci/pandocfilters_1605102427207/work
paramiko @ file:///tmp/build/80754af9/paramiko_1598886428689/work
parso==0.7.0
pathspec==0.7.0
pexpect @ file:///tmp/build/80754af9/pexpect_1605563209008/work
pickleshare @ file:///tmp/build/80754af9/pickleshare_1606932040724/work
Pillow @ file:///C:/ci/pillow_1614711461059/work
pluggy==0.13.1
prompt-toolkit @ file:///tmp/build/80754af9/prompt-toolkit_1602688806899/work
protobuf==3.15.6
psutil @ file:///C:/ci/psutil_1612298033174/work
ptyprocess @ file:///tmp/build/80754af9/ptyprocess_1609355006118/work/dist/ptyprocess-0.7.0-py2.py3-none-any.whl
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycodestyle @ file:///home/ktietz/src/ci_mi/pycodestyle_1612807597675/work
pycparser @ file:///tmp/build/80754af9/pycparser_1594388511720/work
pycryptodome==3.10.1
pydocstyle @ file:///tmp/build/80754af9/pydocstyle_1598885001695/work
pyflakes @ file:///home/ktietz/src/ci_ipy2/pyflakes_1612551159640/work
Pygments @ file:///tmp/build/80754af9/pygments_1615143339740/work
pylint @ file:///C:/ci/pylint_1614971299523/work
pyls-black @ file:///tmp/build/80754af9/pyls-black_1607553132291/work
pyls-spyder @ file:///tmp/build/80754af9/pyls-spyder_1613849700860/work
PyNaCl @ file:///C:/ci/pynacl_1595009241355/work
pynput @ file:///D:/bld/pynput_1602640436928/work
pyOpenSSL @ file:///tmp/build/80754af9/pyopenssl_1608057966937/work
pyparsing @ file:///home/linux1/recipes/ci/pyparsing_1610983426697/work
pyrsistent @ file:///C:/ci/pyrsistent_1600123688363/work
pyscreenshot==2.3
PySocks @ file:///C:/ci/pysocks_1594394709107/work
python-dateutil @ file:///home/ktietz/src/ci/python-dateutil_1611928101742/work
python-jsonrpc-server @ file:///tmp/build/80754af9/python-jsonrpc-server_1600278539111/work
python-language-server @ file:///tmp/build/80754af9/python-language-server_1607972495879/work
python-xlib==0.28
pytz @ file:///tmp/build/80754af9/pytz_1612215392582/work
PyWavelets @ file:///C:/ci/pywavelets_1601658407053/work
pywin32==227
pywin32-ctypes @ file:///C:/ci/pywin32-ctypes_1594392691209/work
PyYAML==5.4.1
pyzmq==20.0.0
QDarkStyle==2.8.1
QtAwesome @ file:///tmp/build/80754af9/qtawesome_1602272867890/work
qtconsole @ file:///tmp/build/80754af9/qtconsole_1612458529756/work
QtPy==1.9.0
regex @ file:///C:/ci/regex_1606691216163/work
requests @ file:///tmp/build/80754af9/requests_1608241421344/work
requests-oauthlib==1.3.0
rope @ file:///tmp/build/80754af9/rope_1602264064449/work
rsa==4.7.2
Rtree==0.9.4
scikit-image==0.17.2
scikit-learn @ file:///C:/ci/scikit-learn_1614446716349/work
scipy @ file:///C:/ci/scipy_1614023124510/work
setuptools-lint==0.6.0
Shapely==1.7.1
six @ file:///C:/ci/six_1605205426665/work
snowballstemmer @ file:///tmp/build/80754af9/snowballstemmer_1611258885636/work
sortedcontainers @ file:///tmp/build/80754af9/sortedcontainers_1606865132123/work
Sphinx @ file:///tmp/build/80754af9/sphinx_1615238060936/work
sphinxcontrib-applehelp @ file:///home/ktietz/src/ci/sphinxcontrib-applehelp_1611920841464/work
sphinxcontrib-devhelp @ file:///home/ktietz/src/ci/sphinxcontrib-devhelp_1611920923094/work
sphinxcontrib-htmlhelp @ file:///home/ktietz/src/ci/sphinxcontrib-htmlhelp_1611920974801/work
sphinxcontrib-jsmath @ file:///home/ktietz/src/ci/sphinxcontrib-jsmath_1611920942228/work
sphinxcontrib-qthelp @ file:///home/ktietz/src/ci/sphinxcontrib-qthelp_1611921055322/work
sphinxcontrib-serializinghtml @ file:///home/ktietz/src/ci/sphinxcontrib-serializinghtml_1611920755253/work
split-folders==0.4.3
spyder @ file:///C:/ci/spyder_1615366463269/work
spyder-kernels @ file:///C:/ci/spyder-kernels_1614030834721/work
streamlink==2.1.1
tensorboard==2.4.1
tensorboard-plugin-wit==1.8.0
tensorboardX==2.1
terminaltables==3.1.0
testpath @ file:///home/ktietz/src/ci/testpath_1611930608132/work
textdistance @ file:///tmp/build/80754af9/textdistance_1612461398012/work
threadpoolctl @ file:///tmp/tmp9twdgx9k/threadpoolctl-2.1.0-py3-none-any.whl
three-merge @ file:///tmp/build/80754af9/three-merge_1607553261110/work
tifffile @ file:///tmp/build/80754af9/tifffile_1614972472976/work
toml @ file:///tmp/build/80754af9/toml_1592853716807/work
toolz @ file:///home/linux1/recipes/ci/toolz_1610987900194/work
torch==1.8.1
torchvision==0.9.1
tornado @ file:///C:/ci/tornado_1606935947090/work
tqdm @ file:///tmp/build/80754af9/tqdm_1611857934208/work
traitlets @ file:///home/ktietz/src/ci/traitlets_1611929699868/work
typed-ast @ file:///C:/ci/typed-ast_1610484654578/work
typing-extensions @ file:///home/ktietz/src/ci_mi/typing_extensions_1612808209620/work
ujson @ file:///C:/ci/ujson_1611244941645/work
urllib3 @ file:///tmp/build/80754af9/urllib3_1611694770489/work
vidgear==0.2.0
watchdog @ file:///C:/ci/watchdog_1612471244702/work
wcwidth @ file:///tmp/build/80754af9/wcwidth_1593447189090/work
webencodings==0.5.1
websocket-client==0.58.0
Werkzeug==1.0.1
win-inet-pton @ file:///C:/ci/win_inet_pton_1605306165655/work
wincertstore==0.2
wrapt @ file:///D:/bld/wrapt_1602463555786/work
yapf @ file:///tmp/build/80754af9/yapf_1593528177422/work
youtube-dl==2021.4.1
zipp @ file:///tmp/build/80754af9/zipp_1604001098328/work
AmanGoyal99 commented 3 years ago

I am also getting the same issue while running for multiple person pose esimtation. When, I am doing without making any changes in code, I am getting this error:

device: 'cpu' Traceback (most recent call last): File "live-demo.py", line 185, in main(**args.dict) File "live-demo.py", line 55, in main model = SimpleHRNet( File "/home/aman/Documents/College_Major_Project/majorproject-env/simple-HRNet/scripts/SimpleHRNet.py", line 130, in init self.detector = YOLOv3(model_def=yolo_model_def, File "/home/aman/Documents/College_Major_Project/majorproject-env/simple-HRNet/scripts/models/detectors/YOLOv3.py", line 101, in init self.model = Darknet(model_def,img_size = img_size).to(self.device) TypeError: init() got an unexpected keyword argument 'img_size'

When I remove, 'img_size' parameter, I get the same error which you get which is :

ValueError: not enough values to unpack (expected 7, got 6)

@stefanopini

stefanopini commented 3 years ago

Thank you all for the feedback.

I will investigate the issue and let you know as soon as I have an update.

stefanopini commented 3 years ago

I think the issue is caused by having the wrong version of PyTorch-YOLOv3. You should have this specific version otherwise it won't work: 47b7c912877ca69db35b8af3a38d6522681b3bb3

@PalakHarwani @moritos @AmanGoyal99

PalakHarwani commented 3 years ago

Hi @stefanopini , I had cloned the repository, I didn't download it manually. Also, I had cloned the yolov3 repo, I didn't use the git submodule command, so I don't think that is causing the issue here. Also, I downloaded the yolov3 repository again using the download button, and it is working, I did not get the same error again.

stefanopini commented 3 years ago

Hi @PalakHarwani

If you cloned the yolov3 repo instead of using the git submodule command, I think that was the problem. I set up git to download a specific version of yolov3 (the one I used when working on this repo) instead of the last one but it works only using git submodule.

Anyway, I'm glad you have this repo working now! Feel free to open another issue if you encounter any other problem.