Models: Import "object_detection/protos/ssd.proto" was not found or had errors --- "Ssd" is not defined

Created on 10 May 2018  路  11Comments  路  Source: tensorflow/models

System information

  • What is the top-level directory of the model you are using: object-detection
  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow):
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 16.04
  • TensorFlow installed from (source or binary): binary
  • TensorFlow version (use command below): v1.8.0-0-g93bc2e2072 1.8.0
  • Bazel version (if compiling from source): --
  • CUDA/cuDNN version: 9.0, 7.1.3
  • GPU model and memory: Tesla P40, totalMemory: 22.38GiB freeMemory: 22.21GiB
  • Exact command to reproduce:

I have installed TensorFlow successfully, and when I try to install Object-Detection-API in issuing below command I got error:
Command:

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

Error:

ction/protos/*.proto --python_out=.
object_detection/protos/ssd.proto:87:3: Expected "required", "optional", or "repeated".
object_detection/protos/ssd.proto:87:12: Expected field name.
object_detection/protos/model.proto: Import "object_detection/protos/ssd.proto" was not found or had errors.
object_detection/protos/model.proto:12:5: "Ssd" is not defined.

I have search on the internet, but did not find any solution, so what should I do?

Most helpful comment

All 11 comments

4047

I have the same problem with you. have you find any way to solve it? need your help,please~ @Bahramudin

@chelixuan I have just asked this question, till now, I did not find any solution for this. But it maybe because of protobuf version which needs to install 3+ version.

@chelixuan The problem was solved by installing the newer version of protobuf.

As the problem is solved, I will close the issue.

@Bahramudin I been crazy about it .(I even want to modify the model.proto code to mute the compile of ssd.proto, but I dare not) And I updated the protobuf's version to the latest 3.5.2.post1, it still did NOT work....so,How is this issue now? you solve it ?

@NNsauce I have solved the problem by installing the newer version of the protobuf.

You can also solve the issue by removing the line 87 of ssd.proto. Which will also solve the issue.
Thanks

this worked for me.
i installed protobuf 3.x version using
https://gist.github.com/sofyanhadia/37787e5ed098c97919b8c593f0ec44d8

later i ran
/usr/local/bin/protoc object_detection/protos/*.proto --python_out=.

try this pyscript... change the researchRoot for yourself.
It works perfectly for me ( I use protobuf 3.6 ).
you can execute the script at any folder.

import sys
import os
import subprocess

researchRoot = os.path.normpath( "D:/Program Files (x86)/Microsoft Visual Studio/Shared/Python36_64/Lib/site-packages/tensorflow/models/research/" )
protoRoots_ = os.listdir(researchRoot)
protoRoots = []

for protoRoot_ in protoRoots_:
    if ( protoRoot_ in protoRoots ):
        continue

    for root, dirs, files in os.walk(os.path.join(researchRoot, protoRoot_)):
        if ( protoRoot_ in protoRoots ):
            break

        for name in files:
            if ( os.path.splitext(name)[1] == ".proto" ):
                protoRoots.append( protoRoot_ )
                break


for protoRoot in protoRoots:
    for root, dirs, files in os.walk(os.path.join(researchRoot, protoRoot)):
        for name in files:
            if ( os.path.splitext(name)[1] == ".proto" ):
                cmdStr = \
                        "protoc " + name + \
                        " --proto_path=\"" + root + "\" " + \
                        " --proto_path=\"" + os.path.join(researchRoot, protoRoot) + "\" " + \
                        " --proto_path=\"" + researchRoot + "\" " + \
                        "--python_out=."

                print(cmdStr)

                with subprocess.Popen(cmdStr, stdout=subprocess.PIPE, shell=True, cwd=researchRoot) as proc:
                    stdout, stderr = proc.communicate()
                    cmdExit = proc.returncode

                    if ( cmdExit != 0 ):
                        print ("cmdExit == " + str(cmdExit) )
                        print ("stdout")
                        print (stdout)
                        print ("stderr")
                        print (stderr)
                    else:  
                        print ("cmdExit == 0")
Was this page helpful?
0 / 5 - 0 ratings