Valueerror Cannot Feed Value of Shape for Tensor Uplaceholder Which Has Shape
Thanks for authors' code. When I run train_c3d_ucf101.py
to train the network, Error shows that
ValueError: Cannot feed value of shape (10,0) for Tensor u 'Placeholder:0', which has shape '(10,16,112,112,3)'
And this is Traceback
I don't know how to solve this problem, could you tell me?
Source: https://lightrun.com/answers/hx173149-c3d-tensorflow-valueerrorcannot-feed-value-of-shape100for-tensor-uplaceholder0
Comments ( 19 )
+4
I also had this problem, mainly because of address errors of 'train.list' and 'test.list' in train_c3d_ucf101.py, so I solved the problem by removing 'list/' from the original 'filename'. filename='train.list'-------line215 filename='test.list'--------line241
+2
@LiXun95 Let me walk you through one step at a time.
Assuming you have extracted C3D-tensorflow to your Documents directory on a Linux system such us Ubuntu, your full path will become ~/Documents/C3D-tensorflow. Use the Terminal to get to this directory
Now in the C3D-tensorflow folder at ~/Documents/C3D-tensorflow copy and paste the UCF101 folder here so that you get ~/Documents/C3D-tensorflow/UCF101.
Navigate to ~/Documents/C3D-tensorflow/list. It has bash files that will not run if you are not logged in as root or using sudo. To overcome this, got to ~/Documents/C3D-tensorflow/list on the terminal and type
chmod +x *.sh
.Open the file ~/Documents/C3D-tensorflow/list/convert_video_to_images.sh" with any text editor. You will notice this expression (
**if (( $(jot -r 1 1 $2) > 1 )); then**
) on line 31 or so . This piece of code will not run properly unless you have jot installed and this is for Linux only, well as far as I know, so I stand to be corrected. To install jot, in your terminal, type sudo apt-get install athena-jot. You can read more about it here. http://www.unixcl.com/2007/12/jot-print-sequential-or-random-data.htmlYou are now ready to generate imaged from your videos. In the terminal, still in the list directory as ~/Documents/C3D-tensorflow/list, type ./convert_video_to_images.sh ~/Documents/C3D-tensorflow/UCF101 5. You can find the explanation in the README file.
You are now ready to generate lists from your images. In the terminal, still in the list directory as ~/Documents/C3D-tensorflow/list, type ./convert_images_to_list.sh ~/Documents/C3D-tensorflow/UCF101 4 You can find the explanation in the README file.
Now move out of the list directory into the ~/Documents/C3D-tensorflow and run the train_c3d_ucf101.py file. If you use Python 2 you should not have problems, I guess. However, if you use python 3.5+ you my have to work on the range functions. You will have to convert them to list because in python 3+, ranges are not necessarily converted to list. So you have to do
**list(range(......))**
I am trying to have that modification done and submitted as a contribution but I am a little time contained now. However, If you ran into some Issues on python 3, please let us know. I will be glad to share my working code with you.
Be sure to also have crop_mean.npy and sports1m_finetuning_ucf101.model files in the ~/Documents/C3D-tensorflow directory if you choose to use the author's codes without modification. Cheers!
+1
same problem. Solved. Do the ./convert_images_to_list.sh inside the list folder …
Thank you ! It really works!
Hi, @rocksyne could you please tell me how I can use this code for feature extraction?
@Shiny128 Are you training from scratch or you are transfer learning?
Hello, I followed the steps mentioned by @rocksyne , I was able to successfully execute train_C3D_tensorflow.py Thanks a lot But even after 50 iterations , ie 50 steps I'm still getting the accuracy =1.000 @rocksyne Please help me resolve this issue.
Thank You 😃
@Caroline1994 that's odd, they are hosted in drop and baiduyun, should work from anywhere
I cannot email them to you because they are too large for email (~300mb).
I believe this topic has now forked into a different conversation. I suggest you create a new issue.
@JulioEndara I have download it successfully,Thank you very much!
@Caroline1994 it's documented in the readme file… read until the end… it's at the bottom in a table. All the models the author mentions are there. Attached screenshot.
Hi, @JulioEndara Could you tell me where to download
./sports1m_finetuning_ucf101.model
?@Caroline1994 I'm starting to look at this repo so may be wrong here but this is what I think regarding your issue:
@LiXun95 To download the sports1m_finetuning_ucf101.model got to https://www.dropbox.com/sh/8wcjrcadx4r31ux/AAAkz3dQ706pPO8ZavrztRCca?dl=0
There are two files.
Download and put both in the C3D-tensorflow extracted folder. You really need these! All two!
To help you rectify the problems, download these files of mine (replacefile.zip) and replace the content in C3D-tensorflow
repalacefile.zip
That should solve your problem. It took me a while to figure this out so I am happy to share with you. Cheers!
Thank you very much! @rocksyne First time I run this program with python 3.5, as you said, there are two main errors I met:
TypeError: unsupported operand type(s) for +: 'dict_values' and 'dict_values'
in line 165varlist1 = list( set(weights.values() + biases.values()) - set(varlist2) )
and line 197 shows the same error.TypeError: 'range' object does not support item assignment
fromFile "/home/lixun/anaconda3/lib/python3.5/random.py", line 272, in shuffle x[i], x[j] = x[j], x[i]
Then I realize it need python 2, I install Anaconda 2 and try to run this program. From @Qing25 and your help I think I put UCF101 in a wrong place, I will retry it, thank you all!
As you say: I need sports1m_finetuning_ucf101.model in my C3D directory, Should I downloads and put it in the directory first time I train C3D model ?
@LiXun95 Well, I suggest you view the image path yourself by opening
train.list
. It seems that the path is relative to filetrain_c3d_ucf101.py
, cut your UCF101 and paste it to the right folder. Do not be afraid to try. 😃Thank you @Qing25 for your answer, Do you mean my UCF101( has converted to images ) is in the wrong folder? Now my UCF101 is in
C3D-tensorflow/list/
, Should I move it toC3D-tensorflow/
?That was because your program didn't read the images correctly.