TensorFlow - object detection module, error appear when trying to use protoc

Viewed 4464

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??

5 Answers

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.

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";

Simply, run protocbuf for each one of them.

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

Related