18

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
  • 2
    UPDATE: So the *.proto is looking for any file with a proto extension. But there are none in that folder. The tutorial says to go to the master-model folder, but the protos are in the research/object_detection/protos folder. So I changed the input to that folder, but now I get an error saying no output directive. I have given the command line an full path and that didn't work. I am not sure what it wants.
    – twofair
    Commented Sep 29, 2017 at 18:41

16 Answers 16

19

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 !

1
  • 2
    This works with version >= 3.5 as well and in one line, great!
    – PHPirate
    Commented Oct 5, 2018 at 14:54
12

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=.
7

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:

  1. Run cmd
  2. change your directory to the research folder you downloaded(may differ):

    cd /d C:\Users\yourusername\Desktop\TensorFlow\models-master\models-master\research
    
  3. Get the location of the protroc.exe file that you downloaded

    C:\Users\yourusername\Desktop\TensorFlow\protoc-3.5.1-win32\bin\protoc 
    
  4. 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
    
  5. 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
    
  6. 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.

3
  • I have cd into /models/research/ and then I ran "C:/Program Files/protoc/bin/protoc.exe" object_detection/protos/*.proto --python_out=. Go the following error The filename, directory name, or volume label syntax is incorrect. Commented Jul 24, 2018 at 19:59
  • The single line command is not working. However we can do it individually as described in 5. Commented Jul 24, 2018 at 20:11
  • When I type this, "protoc object_detection/protos/*.proto --python_out=." into the command line. I am getting an error message that says, 'protoc' is not recognized as an internal or external command. Do you know why this might be occurring? The GitHub code I am following is: github.com/nicknochnack/TFODCourse/blob/main/…
    – user18543051
    Commented Jul 22, 2022 at 13:53
5

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
1
  • 1
    protoc --python_out=. .\object_detection\protos\graph_rewriter.proto is missing Commented Jul 30, 2018 at 3:48
4

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=.

1
  • 1
    Thank you for this! took me a while to to find this answer! Commented Feb 2, 2022 at 18:03
2

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=.

1

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.

1

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

0

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=.

0

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

0

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.

0

I have same problem on ubuntu 16.04. Change directory to research and now this file missing problem solved.

0

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=.

0

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)
0

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=.)
0

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.