Failure to compile .protos with Ubuntu 16.04.4 'protobuf-compiler' v2.6.1 package.
root@f046cb331de6:/tensorflow/models/research# cat /etc/os-release
NAME="Ubuntu"
VERSION="16.04.4 LTS (Xenial Xerus)"
...
root@f046cb331de6:/tensorflow/models/research# python --version
Python 3.5.2
root@f046cb331de6:/tensorflow/models/research# protoc --version
libprotoc 2.6.1
root@f046cb331de6:/tensorflow/models/research# protoc object_detection/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.
Edit: Not the correct solution - See following comment
Compiled Protobuf from source, v3.5.1, and it fixed the issue with compiling. Installation instructions state to use Protobuf 2.6. This may need to be reconsidered.
https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md
root@f046cb331de6:/tensorflow/models/research# /usr/local/bin/protoc --version
libprotoc 3.5.1
root@f046cb331de6:/tensorflow/models/research# /usr/local/bin/protoc object_detection/protos/*.proto --python_out=.
root@f046cb331de6:/tensorflow/models/research#
The solution recommended did not end up working for runtime. Apparently there are Protobuf2 dependencies.
Ended up finding out the issue with Protobuf2 compilation. A week ago a new introduction was added that broke compilation of ssd.proto line 87 6b72b5cd6c692b1da8481e7ac0565f11cab9c6bd
Removed that line and tests pass. Able to run tutorial to completion successfully now.
Meet this issue, too. But thanks to @mastash3ff's solution, it works.
@huzq85 What line did you remove?
@mastash3ff what line should I remove please
@AliceDinh , line 87: reserved 6;
We updated the installation dependencies to require Protobuf 3+.
The instructions list Protobuf 3+ as a dependency, but provide examples on Ubuntu 16.04 that install the protobuf 2 compiler:
The remaining libraries can be installed on Ubuntu 16.04 using via apt-get:
sudo apt-get install protobuf-compiler python-pil python-lxml python-tk
The problem is that many people are still using Ubuntu 16.04 (tensorflow default build platform), and there aren't any convenient packages on 16.04 that provide the newer protobuf compiler. So the install docs don't actually work unless you remove the 'reserved' keyword.
@AliceDinh , line 87: reserved 6;
The latest clone has reserved 6;
on line 147. Removing this line worked for me as well.
Most helpful comment
The solution recommended did not end up working for runtime. Apparently there are Protobuf2 dependencies.
Ended up finding out the issue with Protobuf2 compilation. A week ago a new introduction was added that broke compilation of ssd.proto line 87 6b72b5cd6c692b1da8481e7ac0565f11cab9c6bd
Removed that line and tests pass. Able to run tutorial to completion successfully now.