LUUTHIENXUAN / Udacity-CarND-System-Integration-Project

MIT License
1 stars 0 forks source link

No `object_detection` module is included. #1

Open tsbertalan opened 6 years ago

tsbertalan commented 6 years ago

https://github.com/LUUTHIENXUAN/Udacity-CarND-System-Integration-Project/blob/c7e51479bbee4a0b3028ea5036aa345e13e352cd/CarND_Capstone/ros/src/tl_detector/light_classification/tl_classifier.py#L10

Is there an install script we need to run first to get this from tensorflow.org?

tsbertalan commented 6 years ago

I see that some of this might be covered in the installation instructions for the Tensorflow Object Detection API.

tsbertalan commented 6 years ago

I made the following install script:

# Install dependencies.
apt-get install protobuf-compiler python-pil python-lxml python-tk
pip install --user Cython contextlib2 jupyter matplotlib

# Install TOD API.
cd
git clone https://github.com/tensorflow/models.git
cd models/research/
protoc object_detection/protos/*.proto --python_out=.
export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim

# Install COCO API.
cd
git clone https://github.com/cocodataset/cocoapi.git
cd cocoapi/PythonAPI
make
cp -r pycocotools ~/models/research/
cd

However, on the protoc object_detection/protos/*.proto --python_out=. line, I get

object_detection/protos/ssd.proto:104:3: Expected "required", "optional", or "repeated".
object_detection/protos/ssd.proto:104: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.

which I treat, likely without good justification, as a warning, then the tl_detector node later dies when I roslaunch launch/styx.launch with

Traceback (most recent call last):
  File "/capstone/ros/src/tl_detector/tl_detector.py", line 9, in <module>
    from light_classification.tl_classifier import TLClassifier
  File "/capstone/ros/src/tl_detector/light_classification/tl_classifier.py", line 10, in <module>
    from object_detection.utils import label_map_util
  File "/root/models/research/object_detection/utils/label_map_util.py", line 22, in <module>
    from object_detection.protos import string_int_label_map_pb2
ImportError: cannot import name string_int_label_map_pb2

The car does drive at this point when I uncheck "manual", so I guess the waypoint-following part of the code works. Naturally, it doesn't stop at red lights since tl_detector has crashed.

tsbertalan commented 6 years ago

I updated the script with these lines to use protoc 3.3.0, and it gets past the previous error.

# Get protoc compiler 3.3.0
cd
wget https://github.com/google/protobuf/releases/download/v3.3.0/protoc-3.3.0-linux-x86_64.zip
unzip protoc-3.3.0-linux-x86_64.zip  -d protoc330
export PROTOC="$(pwd)/protoc330/bin/protoc"

# Compile protobuf files
cd
cd models/research/
"$PROTOC" object_detection/protos/*.proto --python_out=.
export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim

However, now it complains about a missing file /home/udacity/Final_project/Traffic_light/traffic_light_model/color_label.pbtx. Running find . -iname "*.pbtx" locates nothing in the root of the repository. Is this something we should make? Or maybe commit into the repo?

LUUTHIENXUAN commented 6 years ago

My bad, I should include the description but you are on the right track now. color_label.pbtx is just a file to define color id with its name.

color_label.zip Below is the content of color_label.pbtx

item { id: 1 name: 'GREEN' }

item { id: 2 name: 'RED' }

item { id: 3 name: 'YELLOW' }