I am following the example found here. But whenever I enter the command "C:/Program Files/protoc/bin/protoc" object_detection/protos/.proto --python_out=. I get an error that says object_detection/protos/.proto: No such file or directory. I can't create a directory called *.proto. So I'm missing some fundamental information on how to do this. Since I can't find anyone else complaining about this issue it must be pretty simple. I am using a windows OS.
问题:
回答1:
Solved for Windows, be in 'research' and have the 'protoc' in path, then this will work:
for /f %i in ('dir /b object_detection\protos\*.proto') do protoc object_detection\protos\%i --python_out=.
Good Luck !
回答2:
Be sure to change the directory to "models\research\" and try to do the steps from the tutorial using the protoc version 3.4.0, just like the tutorial. I only worked for me using 3.4.0.
my cmd line that worked:
C:\Users\...\protoc-3.4.0-win32\bin\protoc object_detection/protos/*.proto --python_out=.
回答3:
I'm going to post this on all these questions I can find so people know. I have to write these directions for myself and others later anyways.
The following does and does not work in a way:
protoc object_detection/protos/*.proto --python_out=.
The *.proto designating all files does not work for the compiler. If you are using version 3.5, you have to specify each individual file.
So here it what it would look like:
- Run cmd
change your directory to the research folder you downloaded(may differ):
cd /d C:\Users\yourusername\Desktop\TensorFlow\models-master\models-master\research
Get the location of the protroc.exe file that you downloaded
C:\Users\yourusername\Desktop\TensorFlow\protoc-3.5.1-win32\bin\protoc
Go to the protos folder so you know what files you need to do individually
C:\Users\yourusername\Desktop\TensorFlow\models-master\models-master\research\object_detection\protos
Now start spamming every individual .proto item in that folder in cmd:
C:\Users\yourusername\Desktop\TensorFlow\protoc-3.5.1-win32\bin\protoc object_detection/protos/anchor_generator.proto --python_out=. C:\Users\yourusername\Desktop\TensorFlow\protoc-3.5.1-win32\bin\protoc object_detection/protos/argmax_matcher.proto --python_out=. C:\Users\yourusername\Desktop\TensorFlow\protoc-3.5.1-win32\bin\protoc object_detection/protos/bipartite_matcher.proto --python_out=. ....and so on until you finish all items in the protos folder
Or you could call it a day and get 3.4 and run:
C:\Users\yourusername\Projects\TensorFlow\protoc-3.5.1-win32\bin\protoc object_detection/protos/*.proto --python_out=.
Let me know if I can clarify some more. I try to be very clear so idiots like me can understand.
回答4:
change the directory to models or model master of tensorflow then you have to compile the .proto files of protobuff using the following commands running one by one
protoc --python_out=. .\object_detection\protos\anchor_generator.proto
protoc --python_out=. .\object_detection\protos\argmax_matcher.proto
protoc --python_out=. .\object_detection\protos\bipartite_matcher.proto
protoc --python_out=. .\object_detection\protos\box_coder.proto
protoc --python_out=. .\object_detection\protos\box_predictor.proto
protoc --python_out=. .\object_detection\protos\eval.proto
protoc --python_out=. .\object_detection\protos\faster_rcnn.proto
protoc --python_out=. .\object_detection\protos\faster_rcnn_box_coder.proto
protoc --python_out=. .\object_detection\protos\grid_anchor_generator.proto
protoc --python_out=. .\object_detection\protos\hyperparams.proto
protoc --python_out=. .\object_detection\protos\image_resizer.proto
protoc --python_out=. .\object_detection\protos\input_reader.proto
protoc --python_out=. .\object_detection\protos\losses.proto
protoc --python_out=. .\object_detection\protos\matcher.proto
protoc --python_out=. .\object_detection\protos\mean_stddev_box_coder.proto
protoc --python_out=. .\object_detection\protos\model.proto
protoc --python_out=. .\object_detection\protos\optimizer.proto
protoc --python_out=. .\object_detection\protos\pipeline.proto
protoc --python_out=. .\object_detection\protos\post_processing.proto
protoc --python_out=. .\object_detection\protos\preprocessor.proto
protoc --python_out=. .\object_detection\protos\region_similarity_calculator.proto
protoc --python_out=. .\object_detection\protos\square_box_coder.proto
protoc --python_out=. .\object_detection\protos\ssd.proto
protoc --python_out=. .\object_detection\protos\ssd_anchor_generator.proto
protoc --python_out=. .\object_detection\protos\string_int_label_map.proto
protoc --python_out=. .\object_detection\protos\train.proto
protoc --python_out=. .\object_detection\protos\keypoint_box_coder.proto
protoc --python_out=. .\object_detection\protos\multiscale_anchor_generator.proto
protoc --python_out=. .\object_detection\protos\graph_rewriter.proto
回答5:
well in my case broke the head longLong time ... the problem was in protoc version 3.5... it does not accepts this arguments on WINDOWS ... it will work completely fine if u will download 3.4.0 version that can be used with your exactly arguments:! protoc object_detection/protos/*.proto --python_out=.
回答6:
If it turns out you you're missing the whole models/research/object_detection/protos
sub-tree like me, you can download it separately from https://github.com/tensorflow/models. Not having these files will give the same error, i.e. No such file or directory
.
回答7:
I have the same error Object_detection/protos/.proto: No such file or directory.
This is solved when I use Protocol Buffers v3.4.0.
Make Sure you are inside models-master\research
and then, use command as:
FullPathToProtoc/protoc-3.4.0-win32/bin/protoc object_detection/protos/*.proto --python_out=.
回答8:
Hi everyone this was how I was able to solve this error while learning about object detection using tensorflow:
STEPS:
1- To download the Google Protobuf for Windows 10 64 bit system, head onto this link. https://github.com/protocolbuffers/protobuf/releases/tag/v3.4.0 and install “protoc-3.4.0-win32.zip”.(Advice-Don't install protoc-3.6.0)
2- Download models file from this link. https://github.com/tensorflow/models
3.Now you need to execute the protobuf compile within the command prompt with help of research directory:
4-First get inside research directory: cd C:\Users\Ankit\tensorflow\models\research and press Enter//just an example
5-Then do this step immediate after above step:
"C:\Users\Ankit\Desktop\Tensorflow\protbuf\bin\protoc.exe" object_detection/protos/*.proto --python_out=. and press Enter(There is space between object and " sign and this is written in one line)
6-Note: Go to the object_detection/protos folder, and if there are .py files, you’ve successfully completed the compilation of your .proto files
THANK YOU
回答9:
The .proto
files should be in tensorflow-models/research/object_detection/protos/
.
So you should first
cd C:\path\to\tensorflow-models\research
as per the installation instructions. The above is an imaginary path and uses the Windows path structure. You should replace it with the actual path on your computer. And when you're in that directory, you can run your command:
C:\Program Files\protoc-<version>\bin\protoc object_detection/protos/.proto --python_out=.
Again, the above is just a general example. You will have to replace <version>
with your protoc
version.
Do NOT copy-paste the above, as it will not work directly on your machine. Instead, you must find the path of the protoc
binary on your computer and use that one as the command before object_detection/protos/.proto --python_out=.
回答10:
sometimes windows Cmd doesn't accept wildcard '*'. that's why it shows error. you can use loop to solve this problam. to create Loop in Cmd checkout this link. https://ss64.com/nt/for.html ref: protoc cannot find files in windows 7
回答11:
I faced the issue of missing output directive
.
The solution that worked out for me was that I tried the full file names as *.proto
was not working.
回答12:
I have same problem on ubuntu 16.04. Change directory to research and now this file missing problem solved.
回答13:
Go to the protoc releases page and download the protoc-3.4.0-win32.zip, extract it, and you will find protoc.exe in the bin directory. then it is needed to be added path to the system path.
Move this to models/research folder tensorflow model project
Next, you can use the protoc command.
protoc object_detection/protos/*.proto --python_out=.
回答14:
A little python code that may help you compile protoc faster
import os
#folder where protos are located
os.chdir('C:\\Users\\ ~ \\models-master\\research\\object_detection\\protos')
#list protos
fs=os.listdir()
#back to where your protoc.exe is located
os.chdir('C:\\Users\\ ~ \\models-master\\research')
for f in fs:
if f.find(".proto")>-1:
print(f)
s='protoc object_detection/protos/'+f+' --python_out=.'
print(s)
os.system(s)
回答15:
This is what I did and I could compile with with 3.4 and 3.6 version on Windows 7 Professional
C:\tensorflow1\models\research>for /F %i in
('dir /b
.\object_detection\protos\*
.proto') do ( c:\tensorflow1\models\research\bin/protoc
.\object_detection\protos\%i --python_out=.)
回答16:
I am using protoc-3.6.1-win32.zip.. On windows
Created a batch file which will compile all the .proto files.
for %%v in object_detection\protos*.proto do ( D:\bin\protoc %%v --python_out=. )
Run this batch file from models\research folder. Do change the protoc path. Hope this helps others and we dont need to install older versions of protoc. Thanks