8

having problems with protoc, the line doesn't work in windows.

I get this errors:

using this line

protoc --proto_path=./object_detection/protos --python_out=c:\testmomo ./object_detection/protos/anchor_generator.proto

I get this error

object_detection/protos/grid_anchor_generator.proto: File not found.
object_detection/protos/ssd_anchor_generator.proto: File not found.
anchor_generator.proto: Import "object_detection/protos/grid_anchor_generator.proto" was not found or had errors.
anchor_generator.proto: Import "object_detection/protos/ssd_anchor_generator.proto" was not found or had errors.
anchor_generator.proto:12:5: "GridAnchorGenerator" is not defined.
anchor_generator.proto:13:5: "SsdAnchorGenerator" is not defined.

what is the problem??

Md. Rezwanul Haque
  • 2,882
  • 7
  • 28
  • 45
user1838270
  • 123
  • 1
  • 5

5 Answers5

15

I was trying different things, and figured out where was the problem.

Make sure you're doing it this way:

# From models/
protoc object_detection/protos/*.proto --python_out=.

whereas I was trying to do it like:

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

that gives me errors as yours.

Check if you're in the right place (directory).

Július Marko
  • 1,196
  • 5
  • 15
  • 37
5

First make note protoc buffer is quite dumb and does not catches all the files properly, you have two options to manually compile all the 29 files or follow below steps.

  1. Copy the protoc exe file to folder where all the proto files are ie "models-master\models-master\research\object_detection\protos" keep protoc.exe and the *.protoc file in same folder

  2. Next open all the files in folder "models-master\research\object_detection\protos" using notepad++.

  3. Press ctrl+f and remove "object_detection/protos/" in all the files ( if you are doing manually also remember the protoc starts in alphabetic order so start from file "anchor_generator.proto").

For example replace:-

import "object_detection/protos/grid_anchor_generator.proto";
import "object_detection/protos/ssd_anchor_generator.proto";
import "object_detection/protos/multiscale_anchor_generator.proto";

with this:-

import "grid_anchor_generator.proto";
import "ssd_anchor_generator.proto";
import "multiscale_anchor_generator.proto";

4.Now open Cmd in the same directory ie "\models master\research\object_detection\protos" type:- protoc *.proto --python_out=. notice you will get new .py file in the folder and no errors on execution of above file.

5.output:-enter image description here

Note:- make sure you open all files and try using the output of step 4 to locate the missing files.

mayure098
  • 111
  • 1
  • 5
0

seems like there is no file: object_detection/protos/grid_anchor_generator.proto and ssd_ancho_generator.proto

did you just clone the models repostitory or have modified something?

J. Doe
  • 51
  • 7
0

In object_detection protos folder the import line is given

import "object_detection/protos/grid_anchor_generator.proto";

Change that to

import "research/object_detection/protos/grid_anchor_generator.proto";
Martin Evans
  • 45,791
  • 17
  • 81
  • 97
Navin
  • 1
0

Simply, run protocbuf for each one of them.

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

shinvt
  • 11
  • This is actually the solution. I don't know why when you run `protoc research/object_detection/protos/*.proto --python_out=.` it misses these 3 files, but you can compile them one by one with no problem. – Azim Nov 06 '18 at 23:40