vidursatija / BlazePalm

PyTorch & CoreML implementation of MediaPipe Hands
MIT License
76 stars 14 forks source link

ValueError: operands could not be broadcast together with remapped shapes [original->remapped]: (2,2) and requested shape (3,2) #6

Open aravind-pp opened 1 year ago

aravind-pp commented 1 year ago

Hi,

Initially, I received this issue. I was able to fix that issue by following the solution mentioned in the issue.

Now, I am getting this error:

aravind@aravind-Latitude-E6420:ML$ python3 run_detector.py 
[W NNPACK.cpp:64] Could not initialize NNPACK! Reason: Unsupported hardware.
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
Traceback (most recent call last):
  File "/home/aravind/work/pp/machine_learning/BlazePalm/ML/run_detector.py", line 33, in <module>
    cropped_hand = np.pad(cropped_hand,
  File "<__array_function__ internals>", line 200, in pad
  File "/home/aravind/.local/lib/python3.10/site-packages/numpy/lib/arraypad.py", line 744, in pad
    pad_width = _as_pairs(pad_width, array.ndim, as_index=True)
  File "/home/aravind/.local/lib/python3.10/site-packages/numpy/lib/arraypad.py", line 518, in _as_pairs
    return np.broadcast_to(x, (ndim, 2)).tolist()
  File "<__array_function__ internals>", line 200, in broadcast_to
  File "/home/aravind/.local/lib/python3.10/site-packages/numpy/lib/stride_tricks.py", line 413, in broadcast_to
    return _broadcast_to(array, shape, subok=subok, readonly=True)
  File "/home/aravind/.local/lib/python3.10/site-packages/numpy/lib/stride_tricks.py", line 349, in _broadcast_to
    it = np.nditer(
ValueError: operands could not be broadcast together with remapped shapes [original->remapped]: (2,2)  and requested shape (3,2)

Please help.

Thank you, Aravind.

vidursatija commented 1 year ago

Hi Aravind! Can you try this

frame = cv.cvtColor(frame, cv.COLOR_BGR2GRAY)

after line 18?

aravind-pp commented 1 year ago

Hi @vidursatija ,

I added above statement after line 18. I am getting this error:

Traceback (most recent call last):
  File "/home/aravind/work/pp/machine_learning/BlazePalm/ML/run_detector.py", line 20, in <module>
    hh, ww, _ = frame.shape
ValueError: not enough values to unpack (expected 3, got 2)
Mayo001 commented 1 year ago

Hi @vidursatija ,

I added above statement after line 18. I am getting this error:

Traceback (most recent call last):
  File "/home/aravind/work/pp/machine_learning/BlazePalm/ML/run_detector.py", line 20, in <module>
    hh, ww, _ = frame.shape
ValueError: not enough values to unpack (expected 3, got 2)

Hi! I also encountered the same error, which was caused by the lack of a return statement in the forward() function.

vidursatija commented 1 year ago

please change it to hh, ww = frame.shape