3

I want to compile protobuf libraries for google object detection API. I followed the official tutorial and typed protoc object_detection/protos/*.proto --python_out=.. Then what I got is "object_detection/protos/*.proto: Invalid argument". Can anyone tell me what should I do? Thanks!

sean
  • 49
  • 1
  • 8
  • I solve this problem by compile the .proto files one by one. I think the problem is the *. I am using win10 system. But still wonder is there a way in windows that I can compile all the .proto files with one command. Compiling them one by one is too silly. – sean Sep 04 '17 at 14:48

3 Answers3

1

If your operating system is windows, then *. may not work. A good way to solve this problem is to use bash. Download git for windows, don't forget to select git bash when you install it. From tensorflow/models/research/, right click, select git bash, then paste the command, it works well on my laptop.

ZhangGa
  • 36
  • 2
  • to check if you have correctly protoced the proto files, go to the tensorflow/models/research/object_detection/protos, you will see many py scripts protoced from the proto files. – ZhangGa Nov 18 '17 at 03:53
0

Try

protoc --python_out=. object_detection/protos/*.proto

Usage:

protoc [OPTION] PROTO_FILES
Tomasz Jakub Rup
  • 10,502
  • 7
  • 48
  • 49
  • Probably shell (`cmd`?) doesn't expand `*.proto` to files. Try other shell or `protoc --python_out=. 1.proto 2.proto 3.proto` – Tomasz Jakub Rup Sep 04 '17 at 16:05
  • That results in this for me: `File does not reside within any path specified using --proto_path (or -I). You must specify a --proto_path which encompasses this file. Note that the proto_path must be an exact prefix of the .proto file names -- protoc is too dumb to figure out when two paths (e.g. absolute and relative) are equivalent (it's harder than you think).` – MrChadMWood Aug 14 '23 at 19:22
0

I know this is a late answer but after some 20 minutes trying out different things, i decided to try it on another terminal and i tried it on git bash.

You need to be in the correct directory so just cd into /models-master/research and make a folder named 1prts using mkdir once you are inside the research directory.

Since the last release, the repos has changed so this is the command you need to run:

protoc object_detection/protos/*.proto --python_out=./1prts