ValueError: Shapes (2, 1) and () are incompatible

2024/11/16 16:01:11

I have to use Tensorflow 0.11 for this code repo and this is the error I get:

(py35) E:\opensource_codes\gesture_recognition\hand3d-master>python run.py
Traceback (most recent call last):File "run.py", line 47, in <module>keypoints_scoremap_tf, keypoint_coord3d_tf = net.inference(image_tf, hand_side_tf, evaluation)File "E:\opensource_codes\gesture_recognition\hand3d-master\net.py", line 37, in inferencehand_mask = single_obj_scoremap(hand_scoremap)File "E:\opensource_codes\gesture_recognition\hand3d-master\utils.py", line 246, in single_obj_scoremapmax_loc = find_max_location(scoremap_fg)File "E:\opensource_codes\gesture_recognition\hand3d-master\utils.py", line 228, in find_max_locationxy_loc.append(tf.concat(0, [x_loc, y_loc]))File "C:\Users\mona6\AppData\Local\conda\conda\envs\py35\lib\site-packages\tensorflow\python\ops\array_ops.py", line 1030, in concat).assert_is_compatible_with(tensor_shape.scalar())File "C:\Users\mona6\AppData\Local\conda\conda\envs\py35\lib\site-packages\tensorflow\python\framework\tensor_shape.py", line 735, in assert_is_compatible_withraise ValueError("Shapes %s and %s are incompatible" % (self, other))
ValueError: Shapes (2, 1) and () are incompatible(py35) E:\opensource_codes\gesture_recognition\hand3d-master>python
Python 3.5.3 |Continuum Analytics, Inc.| (default, Feb 22 2017, 21:28:42) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> tf.__version__
'1.1.0'
>>>

Please suggest fixes.

The error seems to stem from the line xy_loc.append(tf.concat(0, [x_loc, y_loc]))

I wanted to make sure that I have the same exact subversion of Tensorflow so I did so but still get the above error.

(py35) E:\opensource_codes\gesture_recognition\hand3d-master>pip install tensorflow==1.1.0rc0
Collecting tensorflow==1.1.0rc0Using cached tensorflow-1.1.0rc0-cp35-cp35m-win_amd64.whl
Requirement already satisfied: protobuf>=3.2.0 in c:\users\mona6\appdata\local\conda\conda\envs\py35\lib\site-packages (from tensorflow==1.1.0rc0)
Requirement already satisfied: six>=1.10.0 in c:\users\mona6\appdata\local\conda\conda\envs\py35\lib\site-packages (from tensorflow==1.1.0rc0)
Requirement already satisfied: werkzeug>=0.11.10 in c:\users\mona6\appdata\local\conda\conda\envs\py35\lib\site-packages (from tensorflow==1.1.0rc0)
Requirement already satisfied: wheel>=0.26 in c:\users\mona6\appdata\local\conda\conda\envs\py35\lib\site-packages (from tensorflow==1.1.0rc0)
Requirement already satisfied: numpy>=1.11.0 in c:\users\mona6\appdata\local\conda\conda\envs\py35\lib\site-packages (from tensorflow==1.1.0rc0)
Requirement already satisfied: setuptools in c:\users\mona6\appdata\local\conda\conda\envs\py35\lib\site-packages (from protobuf>=3.2.0->tensorflow==1.1.0rc0)
Requirement already satisfied: appdirs>=1.4.0 in c:\users\mona6\appdata\local\conda\conda\envs\py35\lib\site-packages (from setuptools->protobuf>=3.2.0->tensorflow==1.1.0rc0)
Requirement already satisfied: packaging>=16.8 in c:\users\mona6\appdata\local\conda\conda\envs\py35\lib\site-packages (from setuptools->protobuf>=3.2.0->tensorflow==1.1.0rc0)
Requirement already satisfied: pyparsing in c:\users\mona6\appdata\local\conda\conda\envs\py35\lib\site-packages (from packaging>=16.8->setuptools->protobuf>=3.2.0->tensorflow==1.1.0rc0)
Installing collected packages: tensorflowFound existing installation: tensorflow 1.1.0Uninstalling tensorflow-1.1.0:Successfully uninstalled tensorflow-1.1.0
Successfully installed tensorflow-1.1.0rc0
Answer

Installed the tensorflow 0.12 and the code worked perfectly with no change: enter image description here

(py35) E:\opensource_codes\gesture_recognition\hand3d-master>pip install tensorflow==1.2.0
Collecting tensorflow==1.2.0Could not find a version that satisfies the requirement tensorflow==1.2.0 (from versions: 0.12.0rc0, 0.12.0rc1, 0.12.0, 0.12.1, 1.0.0, 1.0.1, 1.1.0rc0, 1.1.0rc1, 1.1.0rc2, 1.1.0)
No matching distribution found for tensorflow==1.2.0(py35) E:\opensource_codes\gesture_recognition\hand3d-master>pip install tensorflow==0.12.1
Collecting tensorflow==0.12.1Downloading tensorflow-0.12.1-cp35-cp35m-win_amd64.whl (13.7MB)100% |################################| 13.8MB 130kB/s
Requirement already satisfied: numpy>=1.11.0 in c:\users\mona6\appdata\local\conda\conda\envs\py35\lib\site-packages (from tensorflow==0.12.1)
Requirement already satisfied: protobuf>=3.1.0 in c:\users\mona6\appdata\local\conda\conda\envs\py35\lib\site-packages (from tensorflow==0.12.1)
Requirement already satisfied: six>=1.10.0 in c:\users\mona6\appdata\local\conda\conda\envs\py35\lib\site-packages (from tensorflow==0.12.1)
Requirement already satisfied: wheel>=0.26 in c:\users\mona6\appdata\local\conda\conda\envs\py35\lib\site-packages (from tensorflow==0.12.1)
Requirement already satisfied: setuptools in c:\users\mona6\appdata\local\conda\conda\envs\py35\lib\site-packages (from protobuf>=3.1.0->tensorflow==0.12.1)
Requirement already satisfied: packaging>=16.8 in c:\users\mona6\appdata\local\conda\conda\envs\py35\lib\site-packages (from setuptools->protobuf>=3.1.0->tensorflow==0.12.1)
Requirement already satisfied: appdirs>=1.4.0 in c:\users\mona6\appdata\local\conda\conda\envs\py35\lib\site-packages (from setuptools->protobuf>=3.1.0->tensorflow==0.12.1)
Requirement already satisfied: pyparsing in c:\users\mona6\appdata\local\conda\conda\envs\py35\lib\site-packages (from packaging>=16.8->setuptools->protobuf>=3.1.0->tensorflow==0.12.1)
Installing collected packages: tensorflowFound existing installation: tensorflow 1.1.0rc0Uninstalling tensorflow-1.1.0rc0:Successfully uninstalled tensorflow-1.1.0rc0
Successfully installed tensorflow-0.12.1(py35) E:\opensource_codes\gesture_recognition\hand3d-master>python run.py
https://en.xdnf.cn/q/118917.html

Related Q&A

Subtotals for Pandas pivot table index and column

Id like to add subtotal rows for index #1 (ie. Fruits and Animal) and subtotal columns for columns (ie. 2015 and 2016).For the subtotal columns, I could do something like this, but it seems inefficient…

Create two new columns derived from original columns in Python

I have a dataframe, df, that contains two columns that contain quarter values. I would like to create two more columns that are the equivalent "long dates". Data ID Quarter Delivery A …

In dataframe: how to pull minutes and seconds combinedly(mm:ss) from timedelta using python

i have already tried these but by this we can only get hour/minute/second but not both minute and second In[7]: df[B] = df[A].dt.components[hours] df Out[7]:A B0 02:00:00 2 1 01:00:00 1from this tim…

Understanding python numpy syntax to mask and filter array

Please help me understand how the lines below are working.How does a pair of parentheses create an array and then individual elements go through logical condition check and create a new array? How doe…

How to get the proper link from a website using python beautifulsoup?

When I try to scrape roster links, I get https://gwsports.com/roster.aspx?path=wpolo when I open it on chrome it changes to https://gwsports.com/sports/mens-water-polo/roster. I want to scrape it in p…

tkinter frame propagate not behaving?

If you uncomment the options_frame_title you will see that it does not behave properly. Am I missing something? That section was just copied and pasted from the preview_frame_title and that seems to h…

python modules installing Error Visual c++ 14.0 is required [duplicate]

This question already has answers here:pip install ecos errors with "Microsoft Visual C++ 14.0 is required." [duplicate](1 answer)Error "Microsoft Visual C++ 14.0 is required (Unable to …

How to render Flask Web App with Javascript [duplicate]

This question already has answers here:Return JSON response from Flask view(15 answers)How to append ajax html response to next to current div(5 answers)Closed 5 years ago.Edit: Hi Ive checked the dupl…

Use start and stop function with same button in Tkinter

With the help of the command button, I am able to disconnect the frame in Tkinter. But is there any way which helps to use the same button to start also?import tkinter as tk counter = 0 def counter_la…

How to restrict my students to dont access teacher area in django? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.Want to improve this question? Update the question so it focuses on one problem only by editing this post.Closed 4…