diff --git a/README.md b/README.md index 604c67e..4c2f7b3 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,20 @@ To run Default SSD (Single Shot Detection) algorithm: 1. Install ROS: http://wiki.ros.org/kinetic/Installation/Ubuntu -2. Install camera dependencies +2. Install vision_msgs Dependency + `sudo apt install ros-kinetic-vision-msgs` - `sudo apt-get install ros-kinetic-usb_cam ros-kinetic-openni2-launch` +3. Install any one of the following camera dependencies + + `sudo apt install ros-kinetic-openni2-launch` (for openni2 supported camera) + + OR + + `sudo apt install ros-kinetic-usb-cam` (usb camera / webcam) + + OR + + `sudo apt install ros-kinetic-cv-camera` (usb camera / webcam) 3. Install tensorflow into python virtualenv: https://www.tensorflow.org/install/install_linux @@ -34,11 +45,9 @@ To run Default SSD (Single Shot Detection) algorithm: `cd ~/catkin_ws/src` - `git clone https://github.com/Kukanani/vision_msgs.git` - `git clone https://github.com/osrf/tensorflow_object_detector.git` -6. Build tensorflow_object_detector and Vision message +6. Build tensorflow_object_detector and Vision message `cd ~/catkin_ws && catkin_make` @@ -54,11 +63,12 @@ To run Default SSD (Single Shot Detection) algorithm: `roslaunch tensorflow_object_detector usb_cam_detector.launch` + OR + `roslaunch tensorflow_object_detector cv_camera_detector.launch` If you want to try any other ML model: -1. Download any Object Detection Models from the Tensorflow Object detection API and place it in `data/models/`. You can find the models in tensorflow Object Detection Model Zoo: https://github.com/tensorflow/models/blob/master/object_detection/g3doc/detection_model_zoo.md. Extract the `tar.gz` file. - -2. Edit the MODEL_NAME and LABEL_NAME in detect_ros.py. By default it is `ssd_mobilenet_v1_coco_11_06_2017` with `mscoco_label_map.pbtxt` respectively. +1. Download any Object Detection Models from the Tensorflow Object detection API. You can find the models in tensorflow Object Detection Model Zoo: https://github.com/tensorflow/models/blob/master/object_detection/g3doc/detection_model_zoo.md. Extract the `tar.gz` file. +2. Edit the parameters in any of the launch file. If no parameters are provided then, `ssd_mobilenet_v2_coco_2018_03_29` is downloaded and stored in `~/data/models`. diff --git a/CMakeLists.txt b/detector/CMakeLists.txt similarity index 90% rename from CMakeLists.txt rename to detector/CMakeLists.txt index 7333b48..aa04e6a 100644 --- a/CMakeLists.txt +++ b/detector/CMakeLists.txt @@ -17,27 +17,7 @@ find_package(catkin REQUIRED COMPONENTS ) ##set the URL to download -set(URL "http://download.tensorflow.org/models/object_detection/ssd_mobilenet_v1_coco_11_06_2017.tar.gz") -set(DOWNLOAD_PATH ${CMAKE_CURRENT_SOURCE_DIR}/data/models/ssd_mobilenet_v1_coco_11_06_2017.tar.gz) -set(EXTRACTED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/data/models) - -if (NOT EXISTS "${EXTRACTED_PATH}/ssd_mobilenet_v1_coco_11_06_2017") - if (NOT EXISTS "${DOWNLOAD_PATH}") - message(STATUS "Downloading SSD model ....") - file( - DOWNLOAD "${URL}" "${DOWNLOAD_PATH}" - SHOW_PROGRESS - ) - endif() - message(STATUS "Extracting...") - execute_process( - COMMAND cmake -E tar xzf ${DOWNLOAD_PATH} - WORKING_DIRECTORY ${EXTRACTED_PATH} - ) -endif() - -file(REMOVE ${DOWNLOAD_PATH}) - + ## System dependencies are found with CMake's conventions # find_package(Boost REQUIRED COMPONENTS system) @@ -133,7 +113,7 @@ catkin_package( # DEPENDS system_lib ) -catkin_install_python(PROGRAMS scripts/detect_ros.py +catkin_install_python(PROGRAMS scripts/detect_ros.py DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}) ########### ## Build ## diff --git a/config/display.rviz b/detector/config/display.rviz similarity index 100% rename from config/display.rviz rename to detector/config/display.rviz diff --git a/data/.gitignore b/detector/data/.gitignore similarity index 100% rename from data/.gitignore rename to detector/data/.gitignore diff --git a/data/labels/mscoco_label_map.pbtxt b/detector/data/labels/mscoco_label_map.pbtxt similarity index 100% rename from data/labels/mscoco_label_map.pbtxt rename to detector/data/labels/mscoco_label_map.pbtxt diff --git a/data/labels/pascal_label_map.pbtxt b/detector/data/labels/pascal_label_map.pbtxt similarity index 100% rename from data/labels/pascal_label_map.pbtxt rename to detector/data/labels/pascal_label_map.pbtxt diff --git a/data/labels/pet_label_map.pbtxt b/detector/data/labels/pet_label_map.pbtxt similarity index 100% rename from data/labels/pet_label_map.pbtxt rename to detector/data/labels/pet_label_map.pbtxt diff --git a/data/models/readme.md b/detector/data/models/readme.md similarity index 100% rename from data/models/readme.md rename to detector/data/models/readme.md diff --git a/detector/launch/cv_camera_detector.launch b/detector/launch/cv_camera_detector.launch new file mode 100644 index 0000000..a2f5901 --- /dev/null +++ b/detector/launch/cv_camera_detector.launch @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/launch/object_detect.launch b/detector/launch/object_detect.launch similarity index 75% rename from launch/object_detect.launch rename to detector/launch/object_detect.launch index 0a4c837..d5fc94b 100644 --- a/launch/object_detect.launch +++ b/detector/launch/object_detect.launch @@ -1,6 +1,10 @@ - + + + + + diff --git a/launch/usb_cam_detector.launch b/detector/launch/usb_cam_detector.launch similarity index 74% rename from launch/usb_cam_detector.launch rename to detector/launch/usb_cam_detector.launch index e1e4135..6580bc5 100644 --- a/launch/usb_cam_detector.launch +++ b/detector/launch/usb_cam_detector.launch @@ -1,6 +1,10 @@ - + + + + + diff --git a/package.xml b/detector/package.xml similarity index 100% rename from package.xml rename to detector/package.xml diff --git a/detector/scripts/detect_ros.py b/detector/scripts/detect_ros.py new file mode 100755 index 0000000..006eccf --- /dev/null +++ b/detector/scripts/detect_ros.py @@ -0,0 +1,225 @@ +#!/usr/bin/env python +## Author: Rohit +## Date: July, 25, 2017 +# Purpose: Ros node to detect objects using tensorflow + +import os +import sys +import cv2 +import tarfile +import numpy as np +try: + import tensorflow as tf +except ImportError: + print("unable to import TensorFlow. Is it installed?") + print(" sudo apt install python-pip") + print(" sudo pip install tensorflow") + sys.exit(1) + +# ROS related imports +import rospy +from std_msgs.msg import String , Header +from sensor_msgs.msg import Image +from cv_bridge import CvBridge, CvBridgeError +from vision_msgs.msg import Detection2D, Detection2DArray, ObjectHypothesisWithPose + +# Object detection module imports +import object_detection +from object_detection.utils import label_map_util +from object_detection.utils import visualization_utils as vis_util +import urllib2 + +DEFAULT_MODEL = os.path.join(os.path.expanduser("~"), "data", "models", "ssd_mobilenet_v1_coco_2018_01_28", "frozen_inference_graph.pb") +DEFAULT_LABELS = os.path.join(os.path.dirname(sys.path[0]), "data", "labels", "mscoco_label_map.pbtxt") + +def download_model(url, location): + + file_name = url.split('/')[-1] + u = urllib2.urlopen(url) + if not os.path.exists(location): + os.makedirs(location) + + file_path = os.path.join(location, os.path.basename(url)) + f = open(file_path, 'wb') + meta = u.info() + file_size = int(meta.getheaders("Content-Length")[0]) + print "Downloading: %s Bytes: %s" % (file_name, file_size) + + file_size_dl = 0 + block_sz = 8192 + while True: + buffer = u.read(block_sz) + if not buffer: + break + + file_size_dl += len(buffer) + f.write(buffer) + status = r"%10d [%3.2f%%]" % (file_size_dl, file_size_dl * 100. / file_size) + status = status + chr(8)*(len(status)+1) + print status, + + f.close() + + return file_path + +def download_data(): + ## Downloading COCO Trained Model + if not os.path.exists(DEFAULT_MODEL): + model_path = os.path.join(os.path.expanduser("~"), "data", "models") + final_path = download_model("http://download.tensorflow.org/models/object_detection/ssd_mobilenet_v1_coco_2018_01_28.tar.gz", model_path) + print final_path + tar = tarfile.open(final_path) + tar.extractall(path=os.path.dirname(final_path)) + tar.close() + +def get_model_params(): + model_path = rospy.get_param("~model_path") + labels_path = rospy.get_param("~labels_path") + + + if (not model_path and not labels_path): + rospy.logwarn("No params passed, using default model") + download_data() + return (DEFAULT_MODEL, DEFAULT_LABELS) + + elif (os.path.exists(os.path.join(model_path, "frozen_inference_graph.pb")) and os.path.exists(labels_path)): + rospy.loginfo("Using Passed parameters") + return (os.path.join(model_path, "frozen_inference_graph.pb"), labels_path) + + else: + raise Exception("Either Incomplete arguments were passed or the paths do not exist. To use the default model do not pass any parameters. NOTE: Please use absolute paths in params") + +# Detection + +class Detector: + + def __init__(self): + + ######### Set model here ############ + path_to_ckpt, path_to_labels = get_model_params() + + num_classes = rospy.get_param("~num_classes") + + detection_graph = tf.Graph() + with detection_graph.as_default(): + od_graph_def = tf.GraphDef() + with tf.gfile.GFile(path_to_ckpt, 'rb') as fid: + serialized_graph = fid.read() + od_graph_def.ParseFromString(serialized_graph) + tf.import_graph_def(od_graph_def, name='') + + ## Loading label map + # Label maps map indices to category names, so that when our convolution network predicts `5`, + # we know that this corresponds to `airplane`. Here we use internal utility functions, + # but anything that returns a dictionary mapping integers to appropriate string labels would be fine + label_map = label_map_util.load_labelmap(path_to_labels) + categories = label_map_util.convert_label_map_to_categories(label_map, max_num_classes=num_classes, use_display_name=True) + self.category_index = label_map_util.create_category_index(categories) + + # Setting the GPU options to use fraction of gpu that has been set + # config = tf.ConfigProto() + # config.gpu_options.per_process_gpu_memory_fraction = GPU_FRACTION + ops = detection_graph.get_operations() + all_tensor_names = {output.name for op in ops for output in op.outputs} + self.tensor_dict = {} + for key in [ + 'num_detections', 'detection_boxes', 'detection_scores', + 'detection_classes', 'detection_masks' + ]: + tensor_name = key + ':0' + if tensor_name in all_tensor_names: + self.tensor_dict[key] = detection_graph.get_tensor_by_name( + tensor_name) + + self.image_tensor = detection_graph.get_tensor_by_name('image_tensor:0') + + self.sess = tf.Session(graph=detection_graph) + + rospy.loginfo("Initializing") + + dummy_tensor = np.zeros((1,1,1,3), dtype=np.int32) + self.sess.run(self.tensor_dict, + feed_dict={self.image_tensor: dummy_tensor}) + + self.image_pub = rospy.Publisher("debug_image",Image, queue_size=1) + self.object_pub = rospy.Publisher("objects", Detection2DArray, queue_size=1) + self.bridge = CvBridge() + self.image_sub = rospy.Subscriber("image", Image, self.image_cb, queue_size=1, buff_size=2**24) + + + def image_cb(self, data): + objArray = Detection2DArray() + try: + cv_image = self.bridge.imgmsg_to_cv2(data, "bgr8") + except CvBridgeError as e: + print(e) + image=cv2.cvtColor(cv_image,cv2.COLOR_BGR2RGB) + + # the array based representation of the image will be used later in order to prepare the + # result image with boxes and labels on it. + image_np = np.asarray(image) + # Expand dimensions since the model expects images to have shape: [1, None, None, 3] + image_np_expanded = np.expand_dims(image_np, axis=0) + + output_dict = self.sess.run(self.tensor_dict, + feed_dict={self.image_tensor: image_np_expanded}) + + objects=vis_util.visualize_boxes_and_labels_on_image_array( + image, + np.squeeze(output_dict["detection_boxes"]), + np.squeeze(output_dict["detection_classes"]).astype(np.int32), + np.squeeze(output_dict["detection_scores"]), + self.category_index, + use_normalized_coordinates=True, + line_thickness=2) + + objArray.detections =[] + objArray.header=data.header + object_count=1 + + for i in range(len(objects)): + object_count+=1 + objArray.detections.append(self.object_predict(objects[i],data.header,image_np,cv_image)) + + self.object_pub.publish(objArray) + + img=cv2.cvtColor(image_np, cv2.COLOR_BGR2RGB) + image_out = Image() + try: + image_out = self.bridge.cv2_to_imgmsg(img,"bgr8") + except CvBridgeError as e: + print(e) + image_out.header = data.header + self.image_pub.publish(image_out) + + def object_predict(self,object_data, header, image_np,image): + image_height,image_width,channels = image.shape + obj=Detection2D() + obj_hypothesis= ObjectHypothesisWithPose() + + object_id=object_data[0] + object_score=object_data[1] + dimensions=object_data[2] + + obj.header=header + obj_hypothesis.id = object_id + obj_hypothesis.score = object_score + obj.results.append(obj_hypothesis) + obj.bbox.size_y = int((dimensions[2]-dimensions[0])*image_height) + obj.bbox.size_x = int((dimensions[3]-dimensions[1] )*image_width) + obj.bbox.center.x = int((dimensions[1] + dimensions [3])*image_width/2) + obj.bbox.center.y = int((dimensions[0] + dimensions[2])*image_height/2) + + return obj + +def main(args): + rospy.init_node('detector_node') + obj=Detector() + try: + rospy.spin() + except KeyboardInterrupt: + print("ShutDown") + cv2.destroyAllWindows() + +if __name__=='__main__': + main(sys.argv) diff --git a/setup.py b/detector/setup.py similarity index 100% rename from setup.py rename to detector/setup.py diff --git a/src/object_detection/__init__.py b/detector/src/object_detection/__init__.py similarity index 100% rename from src/object_detection/__init__.py rename to detector/src/object_detection/__init__.py diff --git a/src/object_detection/anchor_generators/__init__.py b/detector/src/object_detection/protos/__init__.py similarity index 100% rename from src/object_detection/anchor_generators/__init__.py rename to detector/src/object_detection/protos/__init__.py diff --git a/src/object_detection/protos/string_int_label_map.proto b/detector/src/object_detection/protos/string_int_label_map.proto similarity index 100% rename from src/object_detection/protos/string_int_label_map.proto rename to detector/src/object_detection/protos/string_int_label_map.proto diff --git a/src/object_detection/protos/string_int_label_map_pb2.py b/detector/src/object_detection/protos/string_int_label_map_pb2.py similarity index 100% rename from src/object_detection/protos/string_int_label_map_pb2.py rename to detector/src/object_detection/protos/string_int_label_map_pb2.py diff --git a/src/object_detection/box_coders/__init__.py b/detector/src/object_detection/utils/__init__.py similarity index 100% rename from src/object_detection/box_coders/__init__.py rename to detector/src/object_detection/utils/__init__.py diff --git a/src/object_detection/utils/label_map_util.py b/detector/src/object_detection/utils/label_map_util.py similarity index 100% rename from src/object_detection/utils/label_map_util.py rename to detector/src/object_detection/utils/label_map_util.py diff --git a/src/object_detection/utils/visualization_utils.py b/detector/src/object_detection/utils/visualization_utils.py similarity index 100% rename from src/object_detection/utils/visualization_utils.py rename to detector/src/object_detection/utils/visualization_utils.py diff --git a/scripts/detect_ros.py b/scripts/detect_ros.py deleted file mode 100755 index 09dd64d..0000000 --- a/scripts/detect_ros.py +++ /dev/null @@ -1,160 +0,0 @@ -#!/usr/bin/env python -## Author: Rohit -## Date: July, 25, 2017 -# Purpose: Ros node to detect objects using tensorflow - -import os -import sys -import cv2 -import numpy as np -try: - import tensorflow as tf -except ImportError: - print("unable to import TensorFlow. Is it installed?") - print(" sudo apt install python-pip") - print(" sudo pip install tensorflow") - sys.exit(1) - -# ROS related imports -import rospy -from std_msgs.msg import String , Header -from sensor_msgs.msg import Image -from cv_bridge import CvBridge, CvBridgeError -from vision_msgs.msg import Detection2D, Detection2DArray, ObjectHypothesisWithPose - -# Object detection module imports -import object_detection -from object_detection.utils import label_map_util -from object_detection.utils import visualization_utils as vis_util - -# SET FRACTION OF GPU YOU WANT TO USE HERE -GPU_FRACTION = 0.4 - -######### Set model here ############ -MODEL_NAME = 'ssd_mobilenet_v1_coco_11_06_2017' -# By default models are stored in data/models/ -MODEL_PATH = os.path.join(os.path.dirname(sys.path[0]),'data','models' , MODEL_NAME) -# Path to frozen detection graph. This is the actual model that is used for the object detection. -PATH_TO_CKPT = MODEL_PATH + '/frozen_inference_graph.pb' -######### Set the label map file here ########### -LABEL_NAME = 'mscoco_label_map.pbtxt' -# By default label maps are stored in data/labels/ -PATH_TO_LABELS = os.path.join(os.path.dirname(sys.path[0]),'data','labels', LABEL_NAME) -######### Set the number of classes here ######### -NUM_CLASSES = 90 - -detection_graph = tf.Graph() -with detection_graph.as_default(): - od_graph_def = tf.GraphDef() - with tf.gfile.GFile(PATH_TO_CKPT, 'rb') as fid: - serialized_graph = fid.read() - od_graph_def.ParseFromString(serialized_graph) - tf.import_graph_def(od_graph_def, name='') - -## Loading label map -# Label maps map indices to category names, so that when our convolution network predicts `5`, -# we know that this corresponds to `airplane`. Here we use internal utility functions, -# but anything that returns a dictionary mapping integers to appropriate string labels would be fine -label_map = label_map_util.load_labelmap(PATH_TO_LABELS) -categories = label_map_util.convert_label_map_to_categories(label_map, max_num_classes=NUM_CLASSES, use_display_name=True) -category_index = label_map_util.create_category_index(categories) - -# Setting the GPU options to use fraction of gpu that has been set -config = tf.ConfigProto() -config.gpu_options.per_process_gpu_memory_fraction = GPU_FRACTION - -# Detection - -class Detector: - - def __init__(self): - self.image_pub = rospy.Publisher("debug_image",Image, queue_size=1) - self.object_pub = rospy.Publisher("objects", Detection2DArray, queue_size=1) - self.bridge = CvBridge() - self.image_sub = rospy.Subscriber("image", Image, self.image_cb, queue_size=1, buff_size=2**24) - self.sess = tf.Session(graph=detection_graph,config=config) - - def image_cb(self, data): - objArray = Detection2DArray() - try: - cv_image = self.bridge.imgmsg_to_cv2(data, "bgr8") - except CvBridgeError as e: - print(e) - image=cv2.cvtColor(cv_image,cv2.COLOR_BGR2RGB) - - # the array based representation of the image will be used later in order to prepare the - # result image with boxes and labels on it. - image_np = np.asarray(image) - # Expand dimensions since the model expects images to have shape: [1, None, None, 3] - image_np_expanded = np.expand_dims(image_np, axis=0) - image_tensor = detection_graph.get_tensor_by_name('image_tensor:0') - # Each box represents a part of the image where a particular object was detected. - boxes = detection_graph.get_tensor_by_name('detection_boxes:0') - # Each score represent how level of confidence for each of the objects. - # Score is shown on the result image, together with the class label. - scores = detection_graph.get_tensor_by_name('detection_scores:0') - classes = detection_graph.get_tensor_by_name('detection_classes:0') - num_detections = detection_graph.get_tensor_by_name('num_detections:0') - - (boxes, scores, classes, num_detections) = self.sess.run([boxes, scores, classes, num_detections], - feed_dict={image_tensor: image_np_expanded}) - - objects=vis_util.visualize_boxes_and_labels_on_image_array( - image, - np.squeeze(boxes), - np.squeeze(classes).astype(np.int32), - np.squeeze(scores), - category_index, - use_normalized_coordinates=True, - line_thickness=2) - - objArray.detections =[] - objArray.header=data.header - object_count=1 - - for i in range(len(objects)): - object_count+=1 - objArray.detections.append(self.object_predict(objects[i],data.header,image_np,cv_image)) - - self.object_pub.publish(objArray) - - img=cv2.cvtColor(image_np, cv2.COLOR_BGR2RGB) - image_out = Image() - try: - image_out = self.bridge.cv2_to_imgmsg(img,"bgr8") - except CvBridgeError as e: - print(e) - image_out.header = data.header - self.image_pub.publish(image_out) - - def object_predict(self,object_data, header, image_np,image): - image_height,image_width,channels = image.shape - obj=Detection2D() - obj_hypothesis= ObjectHypothesisWithPose() - - object_id=object_data[0] - object_score=object_data[1] - dimensions=object_data[2] - - obj.header=header - obj_hypothesis.id = object_id - obj_hypothesis.score = object_score - obj.results.append(obj_hypothesis) - obj.bbox.size_y = int((dimensions[2]-dimensions[0])*image_height) - obj.bbox.size_x = int((dimensions[3]-dimensions[1] )*image_width) - obj.bbox.center.x = int((dimensions[1] + dimensions [3])*image_height/2) - obj.bbox.center.y = int((dimensions[0] + dimensions[2])*image_width/2) - - return obj - -def main(args): - rospy.init_node('detector_node') - obj=Detector() - try: - rospy.spin() - except KeyboardInterrupt: - print("ShutDown") - cv2.destroyAllWindows() - -if __name__=='__main__': - main(sys.argv) diff --git a/src/object_detection/__init__.pyc b/src/object_detection/__init__.pyc deleted file mode 100644 index 2bbb6de..0000000 Binary files a/src/object_detection/__init__.pyc and /dev/null differ diff --git a/src/object_detection/anchor_generators/__init__.pyc b/src/object_detection/anchor_generators/__init__.pyc deleted file mode 100644 index 109b8b3..0000000 Binary files a/src/object_detection/anchor_generators/__init__.pyc and /dev/null differ diff --git a/src/object_detection/anchor_generators/grid_anchor_generator.pyc b/src/object_detection/anchor_generators/grid_anchor_generator.pyc deleted file mode 100644 index 9b047eb..0000000 Binary files a/src/object_detection/anchor_generators/grid_anchor_generator.pyc and /dev/null differ diff --git a/src/object_detection/anchor_generators/multiple_grid_anchor_generator.pyc b/src/object_detection/anchor_generators/multiple_grid_anchor_generator.pyc deleted file mode 100644 index 5a9096a..0000000 Binary files a/src/object_detection/anchor_generators/multiple_grid_anchor_generator.pyc and /dev/null differ diff --git a/src/object_detection/box_coders/__init__.pyc b/src/object_detection/box_coders/__init__.pyc deleted file mode 100644 index 75c6f6f..0000000 Binary files a/src/object_detection/box_coders/__init__.pyc and /dev/null differ diff --git a/src/object_detection/box_coders/faster_rcnn_box_coder.pyc b/src/object_detection/box_coders/faster_rcnn_box_coder.pyc deleted file mode 100644 index 9bf3799..0000000 Binary files a/src/object_detection/box_coders/faster_rcnn_box_coder.pyc and /dev/null differ diff --git a/src/object_detection/box_coders/mean_stddev_box_coder.pyc b/src/object_detection/box_coders/mean_stddev_box_coder.pyc deleted file mode 100644 index 1311da5..0000000 Binary files a/src/object_detection/box_coders/mean_stddev_box_coder.pyc and /dev/null differ diff --git a/src/object_detection/box_coders/square_box_coder.pyc b/src/object_detection/box_coders/square_box_coder.pyc deleted file mode 100644 index e93ad70..0000000 Binary files a/src/object_detection/box_coders/square_box_coder.pyc and /dev/null differ diff --git a/src/object_detection/builders/__init__.pyc b/src/object_detection/builders/__init__.pyc deleted file mode 100644 index b102acb..0000000 Binary files a/src/object_detection/builders/__init__.pyc and /dev/null differ diff --git a/src/object_detection/builders/anchor_generator_builder.pyc b/src/object_detection/builders/anchor_generator_builder.pyc deleted file mode 100644 index 75c42b0..0000000 Binary files a/src/object_detection/builders/anchor_generator_builder.pyc and /dev/null differ diff --git a/src/object_detection/builders/box_coder_builder.pyc b/src/object_detection/builders/box_coder_builder.pyc deleted file mode 100644 index 6e649ef..0000000 Binary files a/src/object_detection/builders/box_coder_builder.pyc and /dev/null differ diff --git a/src/object_detection/builders/box_predictor_builder.pyc b/src/object_detection/builders/box_predictor_builder.pyc deleted file mode 100644 index e0b0d90..0000000 Binary files a/src/object_detection/builders/box_predictor_builder.pyc and /dev/null differ diff --git a/src/object_detection/builders/hyperparams_builder.pyc b/src/object_detection/builders/hyperparams_builder.pyc deleted file mode 100644 index 940509a..0000000 Binary files a/src/object_detection/builders/hyperparams_builder.pyc and /dev/null differ diff --git a/src/object_detection/builders/image_resizer_builder.pyc b/src/object_detection/builders/image_resizer_builder.pyc deleted file mode 100644 index 7cf60a3..0000000 Binary files a/src/object_detection/builders/image_resizer_builder.pyc and /dev/null differ diff --git a/src/object_detection/builders/losses_builder.pyc b/src/object_detection/builders/losses_builder.pyc deleted file mode 100644 index 8d250ed..0000000 Binary files a/src/object_detection/builders/losses_builder.pyc and /dev/null differ diff --git a/src/object_detection/builders/matcher_builder.pyc b/src/object_detection/builders/matcher_builder.pyc deleted file mode 100644 index 08243e2..0000000 Binary files a/src/object_detection/builders/matcher_builder.pyc and /dev/null differ diff --git a/src/object_detection/builders/model_builder.pyc b/src/object_detection/builders/model_builder.pyc deleted file mode 100644 index 59c6def..0000000 Binary files a/src/object_detection/builders/model_builder.pyc and /dev/null differ diff --git a/src/object_detection/builders/post_processing_builder.pyc b/src/object_detection/builders/post_processing_builder.pyc deleted file mode 100644 index eb69bea..0000000 Binary files a/src/object_detection/builders/post_processing_builder.pyc and /dev/null differ diff --git a/src/object_detection/builders/region_similarity_calculator_builder.pyc b/src/object_detection/builders/region_similarity_calculator_builder.pyc deleted file mode 100644 index 5e9b1f0..0000000 Binary files a/src/object_detection/builders/region_similarity_calculator_builder.pyc and /dev/null differ diff --git a/src/object_detection/core/__init__.pyc b/src/object_detection/core/__init__.pyc deleted file mode 100644 index 7429bfb..0000000 Binary files a/src/object_detection/core/__init__.pyc and /dev/null differ diff --git a/src/object_detection/core/anchor_generator.pyc b/src/object_detection/core/anchor_generator.pyc deleted file mode 100644 index 131ce2c..0000000 Binary files a/src/object_detection/core/anchor_generator.pyc and /dev/null differ diff --git a/src/object_detection/core/balanced_positive_negative_sampler.pyc b/src/object_detection/core/balanced_positive_negative_sampler.pyc deleted file mode 100644 index b4f2f08..0000000 Binary files a/src/object_detection/core/balanced_positive_negative_sampler.pyc and /dev/null differ diff --git a/src/object_detection/core/box_coder.pyc b/src/object_detection/core/box_coder.pyc deleted file mode 100644 index 073c0a5..0000000 Binary files a/src/object_detection/core/box_coder.pyc and /dev/null differ diff --git a/src/object_detection/core/box_list.pyc b/src/object_detection/core/box_list.pyc deleted file mode 100644 index 770e133..0000000 Binary files a/src/object_detection/core/box_list.pyc and /dev/null differ diff --git a/src/object_detection/core/box_list_ops.pyc b/src/object_detection/core/box_list_ops.pyc deleted file mode 100644 index 3eaf754..0000000 Binary files a/src/object_detection/core/box_list_ops.pyc and /dev/null differ diff --git a/src/object_detection/core/box_predictor.pyc b/src/object_detection/core/box_predictor.pyc deleted file mode 100644 index 10cf792..0000000 Binary files a/src/object_detection/core/box_predictor.pyc and /dev/null differ diff --git a/src/object_detection/core/keypoint_ops.pyc b/src/object_detection/core/keypoint_ops.pyc deleted file mode 100644 index 73185e0..0000000 Binary files a/src/object_detection/core/keypoint_ops.pyc and /dev/null differ diff --git a/src/object_detection/core/losses.pyc b/src/object_detection/core/losses.pyc deleted file mode 100644 index 569a353..0000000 Binary files a/src/object_detection/core/losses.pyc and /dev/null differ diff --git a/src/object_detection/core/matcher.pyc b/src/object_detection/core/matcher.pyc deleted file mode 100644 index 73d7528..0000000 Binary files a/src/object_detection/core/matcher.pyc and /dev/null differ diff --git a/src/object_detection/core/minibatch_sampler.pyc b/src/object_detection/core/minibatch_sampler.pyc deleted file mode 100644 index fe80459..0000000 Binary files a/src/object_detection/core/minibatch_sampler.pyc and /dev/null differ diff --git a/src/object_detection/core/model.pyc b/src/object_detection/core/model.pyc deleted file mode 100644 index 6333f99..0000000 Binary files a/src/object_detection/core/model.pyc and /dev/null differ diff --git a/src/object_detection/core/post_processing.pyc b/src/object_detection/core/post_processing.pyc deleted file mode 100644 index a72b8ca..0000000 Binary files a/src/object_detection/core/post_processing.pyc and /dev/null differ diff --git a/src/object_detection/core/preprocessor.pyc b/src/object_detection/core/preprocessor.pyc deleted file mode 100644 index f604f4a..0000000 Binary files a/src/object_detection/core/preprocessor.pyc and /dev/null differ diff --git a/src/object_detection/core/region_similarity_calculator.pyc b/src/object_detection/core/region_similarity_calculator.pyc deleted file mode 100644 index 5c385e7..0000000 Binary files a/src/object_detection/core/region_similarity_calculator.pyc and /dev/null differ diff --git a/src/object_detection/core/standard_fields.pyc b/src/object_detection/core/standard_fields.pyc deleted file mode 100644 index 6cfd74f..0000000 Binary files a/src/object_detection/core/standard_fields.pyc and /dev/null differ diff --git a/src/object_detection/core/target_assigner.pyc b/src/object_detection/core/target_assigner.pyc deleted file mode 100644 index c30b622..0000000 Binary files a/src/object_detection/core/target_assigner.pyc and /dev/null differ diff --git a/src/object_detection/matchers/__init__.pyc b/src/object_detection/matchers/__init__.pyc deleted file mode 100644 index 97a04ee..0000000 Binary files a/src/object_detection/matchers/__init__.pyc and /dev/null differ diff --git a/src/object_detection/matchers/argmax_matcher.pyc b/src/object_detection/matchers/argmax_matcher.pyc deleted file mode 100644 index 93324ee..0000000 Binary files a/src/object_detection/matchers/argmax_matcher.pyc and /dev/null differ diff --git a/src/object_detection/matchers/bipartite_matcher.pyc b/src/object_detection/matchers/bipartite_matcher.pyc deleted file mode 100644 index 132d9ee..0000000 Binary files a/src/object_detection/matchers/bipartite_matcher.pyc and /dev/null differ diff --git a/src/object_detection/meta_architectures/__init__.pyc b/src/object_detection/meta_architectures/__init__.pyc deleted file mode 100644 index 670496e..0000000 Binary files a/src/object_detection/meta_architectures/__init__.pyc and /dev/null differ diff --git a/src/object_detection/meta_architectures/faster_rcnn_meta_arch.pyc b/src/object_detection/meta_architectures/faster_rcnn_meta_arch.pyc deleted file mode 100644 index 72703d5..0000000 Binary files a/src/object_detection/meta_architectures/faster_rcnn_meta_arch.pyc and /dev/null differ diff --git a/src/object_detection/meta_architectures/rfcn_meta_arch.pyc b/src/object_detection/meta_architectures/rfcn_meta_arch.pyc deleted file mode 100644 index 39a323a..0000000 Binary files a/src/object_detection/meta_architectures/rfcn_meta_arch.pyc and /dev/null differ diff --git a/src/object_detection/meta_architectures/ssd_meta_arch.pyc b/src/object_detection/meta_architectures/ssd_meta_arch.pyc deleted file mode 100644 index 1bb517e..0000000 Binary files a/src/object_detection/meta_architectures/ssd_meta_arch.pyc and /dev/null differ diff --git a/src/object_detection/models/__init__.pyc b/src/object_detection/models/__init__.pyc deleted file mode 100644 index aa9fcb1..0000000 Binary files a/src/object_detection/models/__init__.pyc and /dev/null differ diff --git a/src/object_detection/models/faster_rcnn_inception_resnet_v2_feature_extractor.pyc b/src/object_detection/models/faster_rcnn_inception_resnet_v2_feature_extractor.pyc deleted file mode 100644 index 81a5151..0000000 Binary files a/src/object_detection/models/faster_rcnn_inception_resnet_v2_feature_extractor.pyc and /dev/null differ diff --git a/src/object_detection/models/faster_rcnn_resnet_v1_feature_extractor.pyc b/src/object_detection/models/faster_rcnn_resnet_v1_feature_extractor.pyc deleted file mode 100644 index c491604..0000000 Binary files a/src/object_detection/models/faster_rcnn_resnet_v1_feature_extractor.pyc and /dev/null differ diff --git a/src/object_detection/models/feature_map_generators.pyc b/src/object_detection/models/feature_map_generators.pyc deleted file mode 100644 index 69f3e51..0000000 Binary files a/src/object_detection/models/feature_map_generators.pyc and /dev/null differ diff --git a/src/object_detection/models/ssd_inception_v2_feature_extractor.pyc b/src/object_detection/models/ssd_inception_v2_feature_extractor.pyc deleted file mode 100644 index 768a569..0000000 Binary files a/src/object_detection/models/ssd_inception_v2_feature_extractor.pyc and /dev/null differ diff --git a/src/object_detection/models/ssd_mobilenet_v1_feature_extractor.pyc b/src/object_detection/models/ssd_mobilenet_v1_feature_extractor.pyc deleted file mode 100644 index f50ac40..0000000 Binary files a/src/object_detection/models/ssd_mobilenet_v1_feature_extractor.pyc and /dev/null differ diff --git a/src/object_detection/protos/anchor_generator_pb2.pyc b/src/object_detection/protos/anchor_generator_pb2.pyc deleted file mode 100644 index 795d2f0..0000000 Binary files a/src/object_detection/protos/anchor_generator_pb2.pyc and /dev/null differ diff --git a/src/object_detection/protos/argmax_matcher_pb2.pyc b/src/object_detection/protos/argmax_matcher_pb2.pyc deleted file mode 100644 index e294706..0000000 Binary files a/src/object_detection/protos/argmax_matcher_pb2.pyc and /dev/null differ diff --git a/src/object_detection/protos/bipartite_matcher_pb2.pyc b/src/object_detection/protos/bipartite_matcher_pb2.pyc deleted file mode 100644 index 14c6cf7..0000000 Binary files a/src/object_detection/protos/bipartite_matcher_pb2.pyc and /dev/null differ diff --git a/src/object_detection/protos/box_coder_pb2.pyc b/src/object_detection/protos/box_coder_pb2.pyc deleted file mode 100644 index 1415eba..0000000 Binary files a/src/object_detection/protos/box_coder_pb2.pyc and /dev/null differ diff --git a/src/object_detection/protos/box_predictor_pb2.pyc b/src/object_detection/protos/box_predictor_pb2.pyc deleted file mode 100644 index ffac3f8..0000000 Binary files a/src/object_detection/protos/box_predictor_pb2.pyc and /dev/null differ diff --git a/src/object_detection/protos/faster_rcnn_box_coder_pb2.pyc b/src/object_detection/protos/faster_rcnn_box_coder_pb2.pyc deleted file mode 100644 index 5712f04..0000000 Binary files a/src/object_detection/protos/faster_rcnn_box_coder_pb2.pyc and /dev/null differ diff --git a/src/object_detection/protos/faster_rcnn_pb2.pyc b/src/object_detection/protos/faster_rcnn_pb2.pyc deleted file mode 100644 index c4d2b9e..0000000 Binary files a/src/object_detection/protos/faster_rcnn_pb2.pyc and /dev/null differ diff --git a/src/object_detection/protos/grid_anchor_generator_pb2.pyc b/src/object_detection/protos/grid_anchor_generator_pb2.pyc deleted file mode 100644 index d773c99..0000000 Binary files a/src/object_detection/protos/grid_anchor_generator_pb2.pyc and /dev/null differ diff --git a/src/object_detection/protos/hyperparams_pb2.pyc b/src/object_detection/protos/hyperparams_pb2.pyc deleted file mode 100644 index 64e8de9..0000000 Binary files a/src/object_detection/protos/hyperparams_pb2.pyc and /dev/null differ diff --git a/src/object_detection/protos/image_resizer_pb2.pyc b/src/object_detection/protos/image_resizer_pb2.pyc deleted file mode 100644 index eb20f5c..0000000 Binary files a/src/object_detection/protos/image_resizer_pb2.pyc and /dev/null differ diff --git a/src/object_detection/protos/losses_pb2.pyc b/src/object_detection/protos/losses_pb2.pyc deleted file mode 100644 index 39e0263..0000000 Binary files a/src/object_detection/protos/losses_pb2.pyc and /dev/null differ diff --git a/src/object_detection/protos/matcher_pb2.pyc b/src/object_detection/protos/matcher_pb2.pyc deleted file mode 100644 index 321c697..0000000 Binary files a/src/object_detection/protos/matcher_pb2.pyc and /dev/null differ diff --git a/src/object_detection/protos/mean_stddev_box_coder_pb2.pyc b/src/object_detection/protos/mean_stddev_box_coder_pb2.pyc deleted file mode 100644 index c12f1f7..0000000 Binary files a/src/object_detection/protos/mean_stddev_box_coder_pb2.pyc and /dev/null differ diff --git a/src/object_detection/protos/post_processing_pb2.pyc b/src/object_detection/protos/post_processing_pb2.pyc deleted file mode 100644 index dab053d..0000000 Binary files a/src/object_detection/protos/post_processing_pb2.pyc and /dev/null differ diff --git a/src/object_detection/protos/region_similarity_calculator_pb2.pyc b/src/object_detection/protos/region_similarity_calculator_pb2.pyc deleted file mode 100644 index c2047fa..0000000 Binary files a/src/object_detection/protos/region_similarity_calculator_pb2.pyc and /dev/null differ diff --git a/src/object_detection/protos/square_box_coder_pb2.pyc b/src/object_detection/protos/square_box_coder_pb2.pyc deleted file mode 100644 index b6aacdc..0000000 Binary files a/src/object_detection/protos/square_box_coder_pb2.pyc and /dev/null differ diff --git a/src/object_detection/protos/ssd_anchor_generator_pb2.pyc b/src/object_detection/protos/ssd_anchor_generator_pb2.pyc deleted file mode 100644 index e726d81..0000000 Binary files a/src/object_detection/protos/ssd_anchor_generator_pb2.pyc and /dev/null differ diff --git a/src/object_detection/protos/ssd_pb2.pyc b/src/object_detection/protos/ssd_pb2.pyc deleted file mode 100644 index 3a5e42f..0000000 Binary files a/src/object_detection/protos/ssd_pb2.pyc and /dev/null differ diff --git a/src/object_detection/utils/ops.pyc b/src/object_detection/utils/ops.pyc deleted file mode 100644 index 031bb38..0000000 Binary files a/src/object_detection/utils/ops.pyc and /dev/null differ diff --git a/src/object_detection/utils/shape_utils.pyc b/src/object_detection/utils/shape_utils.pyc deleted file mode 100644 index 0084a67..0000000 Binary files a/src/object_detection/utils/shape_utils.pyc and /dev/null differ diff --git a/src/object_detection/utils/static_shape.pyc b/src/object_detection/utils/static_shape.pyc deleted file mode 100644 index 222d8ac..0000000 Binary files a/src/object_detection/utils/static_shape.pyc and /dev/null differ diff --git a/src/object_detection/utils/variables_helper.pyc b/src/object_detection/utils/variables_helper.pyc deleted file mode 100644 index 933a09a..0000000 Binary files a/src/object_detection/utils/variables_helper.pyc and /dev/null differ diff --git a/src/object_detection/.ipynb_checkpoints/object_detection_tutorial-checkpoint.ipynb b/train/src/object_detection/.ipynb_checkpoints/object_detection_tutorial-checkpoint.ipynb similarity index 100% rename from src/object_detection/.ipynb_checkpoints/object_detection_tutorial-checkpoint.ipynb rename to train/src/object_detection/.ipynb_checkpoints/object_detection_tutorial-checkpoint.ipynb diff --git a/src/object_detection/BUILD b/train/src/object_detection/BUILD similarity index 100% rename from src/object_detection/BUILD rename to train/src/object_detection/BUILD diff --git a/src/object_detection/CONTRIBUTING.md b/train/src/object_detection/CONTRIBUTING.md similarity index 100% rename from src/object_detection/CONTRIBUTING.md rename to train/src/object_detection/CONTRIBUTING.md diff --git a/src/object_detection/README.md b/train/src/object_detection/README.md similarity index 100% rename from src/object_detection/README.md rename to train/src/object_detection/README.md diff --git a/src/object_detection/builders/__init__.py b/train/src/object_detection/__init__.py similarity index 100% rename from src/object_detection/builders/__init__.py rename to train/src/object_detection/__init__.py diff --git a/src/object_detection/anchor_generators/BUILD b/train/src/object_detection/anchor_generators/BUILD similarity index 100% rename from src/object_detection/anchor_generators/BUILD rename to train/src/object_detection/anchor_generators/BUILD diff --git a/src/object_detection/core/__init__.py b/train/src/object_detection/anchor_generators/__init__.py similarity index 100% rename from src/object_detection/core/__init__.py rename to train/src/object_detection/anchor_generators/__init__.py diff --git a/src/object_detection/anchor_generators/grid_anchor_generator.py b/train/src/object_detection/anchor_generators/grid_anchor_generator.py similarity index 100% rename from src/object_detection/anchor_generators/grid_anchor_generator.py rename to train/src/object_detection/anchor_generators/grid_anchor_generator.py diff --git a/src/object_detection/anchor_generators/grid_anchor_generator_test.py b/train/src/object_detection/anchor_generators/grid_anchor_generator_test.py similarity index 100% rename from src/object_detection/anchor_generators/grid_anchor_generator_test.py rename to train/src/object_detection/anchor_generators/grid_anchor_generator_test.py diff --git a/src/object_detection/anchor_generators/multiple_grid_anchor_generator.py b/train/src/object_detection/anchor_generators/multiple_grid_anchor_generator.py similarity index 100% rename from src/object_detection/anchor_generators/multiple_grid_anchor_generator.py rename to train/src/object_detection/anchor_generators/multiple_grid_anchor_generator.py diff --git a/src/object_detection/anchor_generators/multiple_grid_anchor_generator_test.py b/train/src/object_detection/anchor_generators/multiple_grid_anchor_generator_test.py similarity index 100% rename from src/object_detection/anchor_generators/multiple_grid_anchor_generator_test.py rename to train/src/object_detection/anchor_generators/multiple_grid_anchor_generator_test.py diff --git a/src/object_detection/box_coders/BUILD b/train/src/object_detection/box_coders/BUILD similarity index 100% rename from src/object_detection/box_coders/BUILD rename to train/src/object_detection/box_coders/BUILD diff --git a/src/object_detection/data_decoders/__init__.py b/train/src/object_detection/box_coders/__init__.py similarity index 100% rename from src/object_detection/data_decoders/__init__.py rename to train/src/object_detection/box_coders/__init__.py diff --git a/src/object_detection/box_coders/faster_rcnn_box_coder.py b/train/src/object_detection/box_coders/faster_rcnn_box_coder.py similarity index 100% rename from src/object_detection/box_coders/faster_rcnn_box_coder.py rename to train/src/object_detection/box_coders/faster_rcnn_box_coder.py diff --git a/src/object_detection/box_coders/faster_rcnn_box_coder_test.py b/train/src/object_detection/box_coders/faster_rcnn_box_coder_test.py similarity index 100% rename from src/object_detection/box_coders/faster_rcnn_box_coder_test.py rename to train/src/object_detection/box_coders/faster_rcnn_box_coder_test.py diff --git a/src/object_detection/box_coders/keypoint_box_coder.py b/train/src/object_detection/box_coders/keypoint_box_coder.py similarity index 100% rename from src/object_detection/box_coders/keypoint_box_coder.py rename to train/src/object_detection/box_coders/keypoint_box_coder.py diff --git a/src/object_detection/box_coders/keypoint_box_coder_test.py b/train/src/object_detection/box_coders/keypoint_box_coder_test.py similarity index 100% rename from src/object_detection/box_coders/keypoint_box_coder_test.py rename to train/src/object_detection/box_coders/keypoint_box_coder_test.py diff --git a/src/object_detection/box_coders/mean_stddev_box_coder.py b/train/src/object_detection/box_coders/mean_stddev_box_coder.py similarity index 100% rename from src/object_detection/box_coders/mean_stddev_box_coder.py rename to train/src/object_detection/box_coders/mean_stddev_box_coder.py diff --git a/src/object_detection/box_coders/mean_stddev_box_coder_test.py b/train/src/object_detection/box_coders/mean_stddev_box_coder_test.py similarity index 100% rename from src/object_detection/box_coders/mean_stddev_box_coder_test.py rename to train/src/object_detection/box_coders/mean_stddev_box_coder_test.py diff --git a/src/object_detection/box_coders/square_box_coder.py b/train/src/object_detection/box_coders/square_box_coder.py similarity index 100% rename from src/object_detection/box_coders/square_box_coder.py rename to train/src/object_detection/box_coders/square_box_coder.py diff --git a/src/object_detection/box_coders/square_box_coder_test.py b/train/src/object_detection/box_coders/square_box_coder_test.py similarity index 100% rename from src/object_detection/box_coders/square_box_coder_test.py rename to train/src/object_detection/box_coders/square_box_coder_test.py diff --git a/src/object_detection/builders/BUILD b/train/src/object_detection/builders/BUILD similarity index 100% rename from src/object_detection/builders/BUILD rename to train/src/object_detection/builders/BUILD diff --git a/src/object_detection/matchers/__init__.py b/train/src/object_detection/builders/__init__.py similarity index 100% rename from src/object_detection/matchers/__init__.py rename to train/src/object_detection/builders/__init__.py diff --git a/src/object_detection/builders/anchor_generator_builder.py b/train/src/object_detection/builders/anchor_generator_builder.py similarity index 100% rename from src/object_detection/builders/anchor_generator_builder.py rename to train/src/object_detection/builders/anchor_generator_builder.py diff --git a/src/object_detection/builders/anchor_generator_builder_test.py b/train/src/object_detection/builders/anchor_generator_builder_test.py similarity index 100% rename from src/object_detection/builders/anchor_generator_builder_test.py rename to train/src/object_detection/builders/anchor_generator_builder_test.py diff --git a/src/object_detection/builders/box_coder_builder.py b/train/src/object_detection/builders/box_coder_builder.py similarity index 100% rename from src/object_detection/builders/box_coder_builder.py rename to train/src/object_detection/builders/box_coder_builder.py diff --git a/src/object_detection/builders/box_coder_builder_test.py b/train/src/object_detection/builders/box_coder_builder_test.py similarity index 100% rename from src/object_detection/builders/box_coder_builder_test.py rename to train/src/object_detection/builders/box_coder_builder_test.py diff --git a/src/object_detection/builders/box_predictor_builder.py b/train/src/object_detection/builders/box_predictor_builder.py similarity index 100% rename from src/object_detection/builders/box_predictor_builder.py rename to train/src/object_detection/builders/box_predictor_builder.py diff --git a/src/object_detection/builders/box_predictor_builder_test.py b/train/src/object_detection/builders/box_predictor_builder_test.py similarity index 100% rename from src/object_detection/builders/box_predictor_builder_test.py rename to train/src/object_detection/builders/box_predictor_builder_test.py diff --git a/src/object_detection/builders/hyperparams_builder.py b/train/src/object_detection/builders/hyperparams_builder.py similarity index 100% rename from src/object_detection/builders/hyperparams_builder.py rename to train/src/object_detection/builders/hyperparams_builder.py diff --git a/src/object_detection/builders/hyperparams_builder_test.py b/train/src/object_detection/builders/hyperparams_builder_test.py similarity index 100% rename from src/object_detection/builders/hyperparams_builder_test.py rename to train/src/object_detection/builders/hyperparams_builder_test.py diff --git a/src/object_detection/builders/image_resizer_builder.py b/train/src/object_detection/builders/image_resizer_builder.py similarity index 100% rename from src/object_detection/builders/image_resizer_builder.py rename to train/src/object_detection/builders/image_resizer_builder.py diff --git a/src/object_detection/builders/image_resizer_builder_test.py b/train/src/object_detection/builders/image_resizer_builder_test.py similarity index 100% rename from src/object_detection/builders/image_resizer_builder_test.py rename to train/src/object_detection/builders/image_resizer_builder_test.py diff --git a/src/object_detection/builders/input_reader_builder.py b/train/src/object_detection/builders/input_reader_builder.py similarity index 100% rename from src/object_detection/builders/input_reader_builder.py rename to train/src/object_detection/builders/input_reader_builder.py diff --git a/src/object_detection/builders/input_reader_builder_test.py b/train/src/object_detection/builders/input_reader_builder_test.py similarity index 100% rename from src/object_detection/builders/input_reader_builder_test.py rename to train/src/object_detection/builders/input_reader_builder_test.py diff --git a/src/object_detection/builders/losses_builder.py b/train/src/object_detection/builders/losses_builder.py similarity index 100% rename from src/object_detection/builders/losses_builder.py rename to train/src/object_detection/builders/losses_builder.py diff --git a/src/object_detection/builders/losses_builder_test.py b/train/src/object_detection/builders/losses_builder_test.py similarity index 100% rename from src/object_detection/builders/losses_builder_test.py rename to train/src/object_detection/builders/losses_builder_test.py diff --git a/src/object_detection/builders/matcher_builder.py b/train/src/object_detection/builders/matcher_builder.py similarity index 100% rename from src/object_detection/builders/matcher_builder.py rename to train/src/object_detection/builders/matcher_builder.py diff --git a/src/object_detection/builders/matcher_builder_test.py b/train/src/object_detection/builders/matcher_builder_test.py similarity index 100% rename from src/object_detection/builders/matcher_builder_test.py rename to train/src/object_detection/builders/matcher_builder_test.py diff --git a/src/object_detection/builders/model_builder.py b/train/src/object_detection/builders/model_builder.py similarity index 100% rename from src/object_detection/builders/model_builder.py rename to train/src/object_detection/builders/model_builder.py diff --git a/src/object_detection/builders/model_builder_test.py b/train/src/object_detection/builders/model_builder_test.py similarity index 100% rename from src/object_detection/builders/model_builder_test.py rename to train/src/object_detection/builders/model_builder_test.py diff --git a/src/object_detection/builders/optimizer_builder.py b/train/src/object_detection/builders/optimizer_builder.py similarity index 100% rename from src/object_detection/builders/optimizer_builder.py rename to train/src/object_detection/builders/optimizer_builder.py diff --git a/src/object_detection/builders/optimizer_builder_test.py b/train/src/object_detection/builders/optimizer_builder_test.py similarity index 100% rename from src/object_detection/builders/optimizer_builder_test.py rename to train/src/object_detection/builders/optimizer_builder_test.py diff --git a/src/object_detection/builders/post_processing_builder.py b/train/src/object_detection/builders/post_processing_builder.py similarity index 100% rename from src/object_detection/builders/post_processing_builder.py rename to train/src/object_detection/builders/post_processing_builder.py diff --git a/src/object_detection/builders/post_processing_builder_test.py b/train/src/object_detection/builders/post_processing_builder_test.py similarity index 100% rename from src/object_detection/builders/post_processing_builder_test.py rename to train/src/object_detection/builders/post_processing_builder_test.py diff --git a/src/object_detection/builders/preprocessor_builder.py b/train/src/object_detection/builders/preprocessor_builder.py similarity index 100% rename from src/object_detection/builders/preprocessor_builder.py rename to train/src/object_detection/builders/preprocessor_builder.py diff --git a/src/object_detection/builders/preprocessor_builder_test.py b/train/src/object_detection/builders/preprocessor_builder_test.py similarity index 100% rename from src/object_detection/builders/preprocessor_builder_test.py rename to train/src/object_detection/builders/preprocessor_builder_test.py diff --git a/src/object_detection/builders/region_similarity_calculator_builder.py b/train/src/object_detection/builders/region_similarity_calculator_builder.py similarity index 100% rename from src/object_detection/builders/region_similarity_calculator_builder.py rename to train/src/object_detection/builders/region_similarity_calculator_builder.py diff --git a/src/object_detection/builders/region_similarity_calculator_builder_test.py b/train/src/object_detection/builders/region_similarity_calculator_builder_test.py similarity index 100% rename from src/object_detection/builders/region_similarity_calculator_builder_test.py rename to train/src/object_detection/builders/region_similarity_calculator_builder_test.py diff --git a/src/object_detection/core/BUILD b/train/src/object_detection/core/BUILD similarity index 100% rename from src/object_detection/core/BUILD rename to train/src/object_detection/core/BUILD diff --git a/src/object_detection/meta_architectures/__init__.py b/train/src/object_detection/core/__init__.py similarity index 100% rename from src/object_detection/meta_architectures/__init__.py rename to train/src/object_detection/core/__init__.py diff --git a/src/object_detection/core/anchor_generator.py b/train/src/object_detection/core/anchor_generator.py similarity index 100% rename from src/object_detection/core/anchor_generator.py rename to train/src/object_detection/core/anchor_generator.py diff --git a/src/object_detection/core/balanced_positive_negative_sampler.py b/train/src/object_detection/core/balanced_positive_negative_sampler.py similarity index 100% rename from src/object_detection/core/balanced_positive_negative_sampler.py rename to train/src/object_detection/core/balanced_positive_negative_sampler.py diff --git a/src/object_detection/core/balanced_positive_negative_sampler_test.py b/train/src/object_detection/core/balanced_positive_negative_sampler_test.py similarity index 100% rename from src/object_detection/core/balanced_positive_negative_sampler_test.py rename to train/src/object_detection/core/balanced_positive_negative_sampler_test.py diff --git a/src/object_detection/core/batcher.py b/train/src/object_detection/core/batcher.py similarity index 100% rename from src/object_detection/core/batcher.py rename to train/src/object_detection/core/batcher.py diff --git a/src/object_detection/core/batcher_test.py b/train/src/object_detection/core/batcher_test.py similarity index 100% rename from src/object_detection/core/batcher_test.py rename to train/src/object_detection/core/batcher_test.py diff --git a/src/object_detection/core/box_coder.py b/train/src/object_detection/core/box_coder.py similarity index 100% rename from src/object_detection/core/box_coder.py rename to train/src/object_detection/core/box_coder.py diff --git a/src/object_detection/core/box_coder_test.py b/train/src/object_detection/core/box_coder_test.py similarity index 100% rename from src/object_detection/core/box_coder_test.py rename to train/src/object_detection/core/box_coder_test.py diff --git a/src/object_detection/core/box_list.py b/train/src/object_detection/core/box_list.py similarity index 100% rename from src/object_detection/core/box_list.py rename to train/src/object_detection/core/box_list.py diff --git a/src/object_detection/core/box_list_ops.py b/train/src/object_detection/core/box_list_ops.py similarity index 100% rename from src/object_detection/core/box_list_ops.py rename to train/src/object_detection/core/box_list_ops.py diff --git a/src/object_detection/core/box_list_ops_test.py b/train/src/object_detection/core/box_list_ops_test.py similarity index 100% rename from src/object_detection/core/box_list_ops_test.py rename to train/src/object_detection/core/box_list_ops_test.py diff --git a/src/object_detection/core/box_list_test.py b/train/src/object_detection/core/box_list_test.py similarity index 100% rename from src/object_detection/core/box_list_test.py rename to train/src/object_detection/core/box_list_test.py diff --git a/src/object_detection/core/box_predictor.py b/train/src/object_detection/core/box_predictor.py similarity index 100% rename from src/object_detection/core/box_predictor.py rename to train/src/object_detection/core/box_predictor.py diff --git a/src/object_detection/core/box_predictor_test.py b/train/src/object_detection/core/box_predictor_test.py similarity index 100% rename from src/object_detection/core/box_predictor_test.py rename to train/src/object_detection/core/box_predictor_test.py diff --git a/src/object_detection/core/data_decoder.py b/train/src/object_detection/core/data_decoder.py similarity index 100% rename from src/object_detection/core/data_decoder.py rename to train/src/object_detection/core/data_decoder.py diff --git a/src/object_detection/core/keypoint_ops.py b/train/src/object_detection/core/keypoint_ops.py similarity index 100% rename from src/object_detection/core/keypoint_ops.py rename to train/src/object_detection/core/keypoint_ops.py diff --git a/src/object_detection/core/keypoint_ops_test.py b/train/src/object_detection/core/keypoint_ops_test.py similarity index 100% rename from src/object_detection/core/keypoint_ops_test.py rename to train/src/object_detection/core/keypoint_ops_test.py diff --git a/src/object_detection/core/losses.py b/train/src/object_detection/core/losses.py similarity index 100% rename from src/object_detection/core/losses.py rename to train/src/object_detection/core/losses.py diff --git a/src/object_detection/core/losses_test.py b/train/src/object_detection/core/losses_test.py similarity index 100% rename from src/object_detection/core/losses_test.py rename to train/src/object_detection/core/losses_test.py diff --git a/src/object_detection/core/matcher.py b/train/src/object_detection/core/matcher.py similarity index 100% rename from src/object_detection/core/matcher.py rename to train/src/object_detection/core/matcher.py diff --git a/src/object_detection/core/matcher_test.py b/train/src/object_detection/core/matcher_test.py similarity index 100% rename from src/object_detection/core/matcher_test.py rename to train/src/object_detection/core/matcher_test.py diff --git a/src/object_detection/core/minibatch_sampler.py b/train/src/object_detection/core/minibatch_sampler.py similarity index 100% rename from src/object_detection/core/minibatch_sampler.py rename to train/src/object_detection/core/minibatch_sampler.py diff --git a/src/object_detection/core/minibatch_sampler_test.py b/train/src/object_detection/core/minibatch_sampler_test.py similarity index 100% rename from src/object_detection/core/minibatch_sampler_test.py rename to train/src/object_detection/core/minibatch_sampler_test.py diff --git a/src/object_detection/core/model.py b/train/src/object_detection/core/model.py similarity index 100% rename from src/object_detection/core/model.py rename to train/src/object_detection/core/model.py diff --git a/src/object_detection/core/post_processing.py b/train/src/object_detection/core/post_processing.py similarity index 100% rename from src/object_detection/core/post_processing.py rename to train/src/object_detection/core/post_processing.py diff --git a/src/object_detection/core/post_processing_test.py b/train/src/object_detection/core/post_processing_test.py similarity index 100% rename from src/object_detection/core/post_processing_test.py rename to train/src/object_detection/core/post_processing_test.py diff --git a/src/object_detection/core/prefetcher.py b/train/src/object_detection/core/prefetcher.py similarity index 100% rename from src/object_detection/core/prefetcher.py rename to train/src/object_detection/core/prefetcher.py diff --git a/src/object_detection/core/prefetcher_test.py b/train/src/object_detection/core/prefetcher_test.py similarity index 100% rename from src/object_detection/core/prefetcher_test.py rename to train/src/object_detection/core/prefetcher_test.py diff --git a/src/object_detection/core/preprocessor.py b/train/src/object_detection/core/preprocessor.py similarity index 100% rename from src/object_detection/core/preprocessor.py rename to train/src/object_detection/core/preprocessor.py diff --git a/src/object_detection/core/preprocessor_test.py b/train/src/object_detection/core/preprocessor_test.py similarity index 100% rename from src/object_detection/core/preprocessor_test.py rename to train/src/object_detection/core/preprocessor_test.py diff --git a/src/object_detection/core/region_similarity_calculator.py b/train/src/object_detection/core/region_similarity_calculator.py similarity index 100% rename from src/object_detection/core/region_similarity_calculator.py rename to train/src/object_detection/core/region_similarity_calculator.py diff --git a/src/object_detection/core/region_similarity_calculator_test.py b/train/src/object_detection/core/region_similarity_calculator_test.py similarity index 100% rename from src/object_detection/core/region_similarity_calculator_test.py rename to train/src/object_detection/core/region_similarity_calculator_test.py diff --git a/src/object_detection/core/standard_fields.py b/train/src/object_detection/core/standard_fields.py similarity index 100% rename from src/object_detection/core/standard_fields.py rename to train/src/object_detection/core/standard_fields.py diff --git a/src/object_detection/core/target_assigner.py b/train/src/object_detection/core/target_assigner.py similarity index 100% rename from src/object_detection/core/target_assigner.py rename to train/src/object_detection/core/target_assigner.py diff --git a/src/object_detection/core/target_assigner_test.py b/train/src/object_detection/core/target_assigner_test.py similarity index 100% rename from src/object_detection/core/target_assigner_test.py rename to train/src/object_detection/core/target_assigner_test.py diff --git a/src/object_detection/create_pascal_tf_record.py b/train/src/object_detection/create_pascal_tf_record.py similarity index 100% rename from src/object_detection/create_pascal_tf_record.py rename to train/src/object_detection/create_pascal_tf_record.py diff --git a/src/object_detection/create_pascal_tf_record_test.py b/train/src/object_detection/create_pascal_tf_record_test.py similarity index 100% rename from src/object_detection/create_pascal_tf_record_test.py rename to train/src/object_detection/create_pascal_tf_record_test.py diff --git a/src/object_detection/create_pet_tf_record.py b/train/src/object_detection/create_pet_tf_record.py similarity index 100% rename from src/object_detection/create_pet_tf_record.py rename to train/src/object_detection/create_pet_tf_record.py diff --git a/src/object_detection/data/mscoco_label_map.pbtxt b/train/src/object_detection/data/mscoco_label_map.pbtxt similarity index 100% rename from src/object_detection/data/mscoco_label_map.pbtxt rename to train/src/object_detection/data/mscoco_label_map.pbtxt diff --git a/src/object_detection/data/pascal_label_map.pbtxt b/train/src/object_detection/data/pascal_label_map.pbtxt similarity index 100% rename from src/object_detection/data/pascal_label_map.pbtxt rename to train/src/object_detection/data/pascal_label_map.pbtxt diff --git a/src/object_detection/data/pet_label_map.pbtxt b/train/src/object_detection/data/pet_label_map.pbtxt similarity index 100% rename from src/object_detection/data/pet_label_map.pbtxt rename to train/src/object_detection/data/pet_label_map.pbtxt diff --git a/src/object_detection/data_decoders/BUILD b/train/src/object_detection/data_decoders/BUILD similarity index 100% rename from src/object_detection/data_decoders/BUILD rename to train/src/object_detection/data_decoders/BUILD diff --git a/src/object_detection/models/__init__.py b/train/src/object_detection/data_decoders/__init__.py similarity index 100% rename from src/object_detection/models/__init__.py rename to train/src/object_detection/data_decoders/__init__.py diff --git a/src/object_detection/data_decoders/tf_example_decoder.py b/train/src/object_detection/data_decoders/tf_example_decoder.py similarity index 100% rename from src/object_detection/data_decoders/tf_example_decoder.py rename to train/src/object_detection/data_decoders/tf_example_decoder.py diff --git a/src/object_detection/data_decoders/tf_example_decoder_test.py b/train/src/object_detection/data_decoders/tf_example_decoder_test.py similarity index 100% rename from src/object_detection/data_decoders/tf_example_decoder_test.py rename to train/src/object_detection/data_decoders/tf_example_decoder_test.py diff --git a/src/object_detection/detect.py b/train/src/object_detection/detect.py similarity index 100% rename from src/object_detection/detect.py rename to train/src/object_detection/detect.py diff --git a/src/object_detection/eval.py b/train/src/object_detection/eval.py similarity index 100% rename from src/object_detection/eval.py rename to train/src/object_detection/eval.py diff --git a/src/object_detection/eval_util.py b/train/src/object_detection/eval_util.py similarity index 100% rename from src/object_detection/eval_util.py rename to train/src/object_detection/eval_util.py diff --git a/src/object_detection/evaluator.py b/train/src/object_detection/evaluator.py similarity index 100% rename from src/object_detection/evaluator.py rename to train/src/object_detection/evaluator.py diff --git a/src/object_detection/export_inference_graph.py b/train/src/object_detection/export_inference_graph.py similarity index 100% rename from src/object_detection/export_inference_graph.py rename to train/src/object_detection/export_inference_graph.py diff --git a/src/object_detection/exporter.py b/train/src/object_detection/exporter.py similarity index 100% rename from src/object_detection/exporter.py rename to train/src/object_detection/exporter.py diff --git a/src/object_detection/exporter_test.py b/train/src/object_detection/exporter_test.py similarity index 100% rename from src/object_detection/exporter_test.py rename to train/src/object_detection/exporter_test.py diff --git a/src/object_detection/g3doc/configuring_jobs.md b/train/src/object_detection/g3doc/configuring_jobs.md similarity index 100% rename from src/object_detection/g3doc/configuring_jobs.md rename to train/src/object_detection/g3doc/configuring_jobs.md diff --git a/src/object_detection/g3doc/defining_your_own_model.md b/train/src/object_detection/g3doc/defining_your_own_model.md similarity index 100% rename from src/object_detection/g3doc/defining_your_own_model.md rename to train/src/object_detection/g3doc/defining_your_own_model.md diff --git a/src/object_detection/g3doc/detection_model_zoo.md b/train/src/object_detection/g3doc/detection_model_zoo.md similarity index 100% rename from src/object_detection/g3doc/detection_model_zoo.md rename to train/src/object_detection/g3doc/detection_model_zoo.md diff --git a/src/object_detection/g3doc/exporting_models.md b/train/src/object_detection/g3doc/exporting_models.md similarity index 100% rename from src/object_detection/g3doc/exporting_models.md rename to train/src/object_detection/g3doc/exporting_models.md diff --git a/src/object_detection/g3doc/img/dogs_detections_output.jpg b/train/src/object_detection/g3doc/img/dogs_detections_output.jpg similarity index 100% rename from src/object_detection/g3doc/img/dogs_detections_output.jpg rename to train/src/object_detection/g3doc/img/dogs_detections_output.jpg diff --git a/src/object_detection/g3doc/img/example_cat.jpg b/train/src/object_detection/g3doc/img/example_cat.jpg similarity index 100% rename from src/object_detection/g3doc/img/example_cat.jpg rename to train/src/object_detection/g3doc/img/example_cat.jpg diff --git a/src/object_detection/g3doc/img/kites_detections_output.jpg b/train/src/object_detection/g3doc/img/kites_detections_output.jpg similarity index 100% rename from src/object_detection/g3doc/img/kites_detections_output.jpg rename to train/src/object_detection/g3doc/img/kites_detections_output.jpg diff --git a/src/object_detection/g3doc/img/oxford_pet.png b/train/src/object_detection/g3doc/img/oxford_pet.png similarity index 100% rename from src/object_detection/g3doc/img/oxford_pet.png rename to train/src/object_detection/g3doc/img/oxford_pet.png diff --git a/src/object_detection/g3doc/img/tensorboard.png b/train/src/object_detection/g3doc/img/tensorboard.png similarity index 100% rename from src/object_detection/g3doc/img/tensorboard.png rename to train/src/object_detection/g3doc/img/tensorboard.png diff --git a/src/object_detection/g3doc/img/tensorboard2.png b/train/src/object_detection/g3doc/img/tensorboard2.png similarity index 100% rename from src/object_detection/g3doc/img/tensorboard2.png rename to train/src/object_detection/g3doc/img/tensorboard2.png diff --git a/src/object_detection/g3doc/installation.md b/train/src/object_detection/g3doc/installation.md similarity index 100% rename from src/object_detection/g3doc/installation.md rename to train/src/object_detection/g3doc/installation.md diff --git a/src/object_detection/g3doc/preparing_inputs.md b/train/src/object_detection/g3doc/preparing_inputs.md similarity index 100% rename from src/object_detection/g3doc/preparing_inputs.md rename to train/src/object_detection/g3doc/preparing_inputs.md diff --git a/src/object_detection/g3doc/running_locally.md b/train/src/object_detection/g3doc/running_locally.md similarity index 100% rename from src/object_detection/g3doc/running_locally.md rename to train/src/object_detection/g3doc/running_locally.md diff --git a/src/object_detection/g3doc/running_notebook.md b/train/src/object_detection/g3doc/running_notebook.md similarity index 100% rename from src/object_detection/g3doc/running_notebook.md rename to train/src/object_detection/g3doc/running_notebook.md diff --git a/src/object_detection/g3doc/running_on_cloud.md b/train/src/object_detection/g3doc/running_on_cloud.md similarity index 100% rename from src/object_detection/g3doc/running_on_cloud.md rename to train/src/object_detection/g3doc/running_on_cloud.md diff --git a/src/object_detection/g3doc/running_pets.md b/train/src/object_detection/g3doc/running_pets.md similarity index 100% rename from src/object_detection/g3doc/running_pets.md rename to train/src/object_detection/g3doc/running_pets.md diff --git a/src/object_detection/g3doc/using_your_own_dataset.md b/train/src/object_detection/g3doc/using_your_own_dataset.md similarity index 100% rename from src/object_detection/g3doc/using_your_own_dataset.md rename to train/src/object_detection/g3doc/using_your_own_dataset.md diff --git a/src/object_detection/matchers/BUILD b/train/src/object_detection/matchers/BUILD similarity index 100% rename from src/object_detection/matchers/BUILD rename to train/src/object_detection/matchers/BUILD diff --git a/src/object_detection/protos/__init__.py b/train/src/object_detection/matchers/__init__.py similarity index 100% rename from src/object_detection/protos/__init__.py rename to train/src/object_detection/matchers/__init__.py diff --git a/src/object_detection/matchers/argmax_matcher.py b/train/src/object_detection/matchers/argmax_matcher.py similarity index 100% rename from src/object_detection/matchers/argmax_matcher.py rename to train/src/object_detection/matchers/argmax_matcher.py diff --git a/src/object_detection/matchers/argmax_matcher_test.py b/train/src/object_detection/matchers/argmax_matcher_test.py similarity index 100% rename from src/object_detection/matchers/argmax_matcher_test.py rename to train/src/object_detection/matchers/argmax_matcher_test.py diff --git a/src/object_detection/matchers/bipartite_matcher.py b/train/src/object_detection/matchers/bipartite_matcher.py similarity index 100% rename from src/object_detection/matchers/bipartite_matcher.py rename to train/src/object_detection/matchers/bipartite_matcher.py diff --git a/src/object_detection/matchers/bipartite_matcher_test.py b/train/src/object_detection/matchers/bipartite_matcher_test.py similarity index 100% rename from src/object_detection/matchers/bipartite_matcher_test.py rename to train/src/object_detection/matchers/bipartite_matcher_test.py diff --git a/src/object_detection/meta_architectures/BUILD b/train/src/object_detection/meta_architectures/BUILD similarity index 100% rename from src/object_detection/meta_architectures/BUILD rename to train/src/object_detection/meta_architectures/BUILD diff --git a/src/object_detection/utils/__init__.py b/train/src/object_detection/meta_architectures/__init__.py similarity index 100% rename from src/object_detection/utils/__init__.py rename to train/src/object_detection/meta_architectures/__init__.py diff --git a/src/object_detection/meta_architectures/faster_rcnn_meta_arch.py b/train/src/object_detection/meta_architectures/faster_rcnn_meta_arch.py similarity index 100% rename from src/object_detection/meta_architectures/faster_rcnn_meta_arch.py rename to train/src/object_detection/meta_architectures/faster_rcnn_meta_arch.py diff --git a/src/object_detection/meta_architectures/faster_rcnn_meta_arch_test.py b/train/src/object_detection/meta_architectures/faster_rcnn_meta_arch_test.py similarity index 100% rename from src/object_detection/meta_architectures/faster_rcnn_meta_arch_test.py rename to train/src/object_detection/meta_architectures/faster_rcnn_meta_arch_test.py diff --git a/src/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py b/train/src/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py similarity index 100% rename from src/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py rename to train/src/object_detection/meta_architectures/faster_rcnn_meta_arch_test_lib.py diff --git a/src/object_detection/meta_architectures/rfcn_meta_arch.py b/train/src/object_detection/meta_architectures/rfcn_meta_arch.py similarity index 100% rename from src/object_detection/meta_architectures/rfcn_meta_arch.py rename to train/src/object_detection/meta_architectures/rfcn_meta_arch.py diff --git a/src/object_detection/meta_architectures/rfcn_meta_arch_test.py b/train/src/object_detection/meta_architectures/rfcn_meta_arch_test.py similarity index 100% rename from src/object_detection/meta_architectures/rfcn_meta_arch_test.py rename to train/src/object_detection/meta_architectures/rfcn_meta_arch_test.py diff --git a/src/object_detection/meta_architectures/ssd_meta_arch.py b/train/src/object_detection/meta_architectures/ssd_meta_arch.py similarity index 100% rename from src/object_detection/meta_architectures/ssd_meta_arch.py rename to train/src/object_detection/meta_architectures/ssd_meta_arch.py diff --git a/src/object_detection/meta_architectures/ssd_meta_arch_test.py b/train/src/object_detection/meta_architectures/ssd_meta_arch_test.py similarity index 100% rename from src/object_detection/meta_architectures/ssd_meta_arch_test.py rename to train/src/object_detection/meta_architectures/ssd_meta_arch_test.py diff --git a/src/object_detection/models/BUILD b/train/src/object_detection/models/BUILD similarity index 100% rename from src/object_detection/models/BUILD rename to train/src/object_detection/models/BUILD diff --git a/train/src/object_detection/models/__init__.py b/train/src/object_detection/models/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/object_detection/models/faster_rcnn_inception_resnet_v2_feature_extractor.py b/train/src/object_detection/models/faster_rcnn_inception_resnet_v2_feature_extractor.py similarity index 100% rename from src/object_detection/models/faster_rcnn_inception_resnet_v2_feature_extractor.py rename to train/src/object_detection/models/faster_rcnn_inception_resnet_v2_feature_extractor.py diff --git a/src/object_detection/models/faster_rcnn_inception_resnet_v2_feature_extractor_test.py b/train/src/object_detection/models/faster_rcnn_inception_resnet_v2_feature_extractor_test.py similarity index 100% rename from src/object_detection/models/faster_rcnn_inception_resnet_v2_feature_extractor_test.py rename to train/src/object_detection/models/faster_rcnn_inception_resnet_v2_feature_extractor_test.py diff --git a/src/object_detection/models/faster_rcnn_resnet_v1_feature_extractor.py b/train/src/object_detection/models/faster_rcnn_resnet_v1_feature_extractor.py similarity index 100% rename from src/object_detection/models/faster_rcnn_resnet_v1_feature_extractor.py rename to train/src/object_detection/models/faster_rcnn_resnet_v1_feature_extractor.py diff --git a/src/object_detection/models/faster_rcnn_resnet_v1_feature_extractor_test.py b/train/src/object_detection/models/faster_rcnn_resnet_v1_feature_extractor_test.py similarity index 100% rename from src/object_detection/models/faster_rcnn_resnet_v1_feature_extractor_test.py rename to train/src/object_detection/models/faster_rcnn_resnet_v1_feature_extractor_test.py diff --git a/src/object_detection/models/feature_map_generators.py b/train/src/object_detection/models/feature_map_generators.py similarity index 100% rename from src/object_detection/models/feature_map_generators.py rename to train/src/object_detection/models/feature_map_generators.py diff --git a/src/object_detection/models/feature_map_generators_test.py b/train/src/object_detection/models/feature_map_generators_test.py similarity index 100% rename from src/object_detection/models/feature_map_generators_test.py rename to train/src/object_detection/models/feature_map_generators_test.py diff --git a/src/object_detection/models/ssd_feature_extractor_test.py b/train/src/object_detection/models/ssd_feature_extractor_test.py similarity index 100% rename from src/object_detection/models/ssd_feature_extractor_test.py rename to train/src/object_detection/models/ssd_feature_extractor_test.py diff --git a/src/object_detection/models/ssd_inception_v2_feature_extractor.py b/train/src/object_detection/models/ssd_inception_v2_feature_extractor.py similarity index 100% rename from src/object_detection/models/ssd_inception_v2_feature_extractor.py rename to train/src/object_detection/models/ssd_inception_v2_feature_extractor.py diff --git a/src/object_detection/models/ssd_inception_v2_feature_extractor_test.py b/train/src/object_detection/models/ssd_inception_v2_feature_extractor_test.py similarity index 100% rename from src/object_detection/models/ssd_inception_v2_feature_extractor_test.py rename to train/src/object_detection/models/ssd_inception_v2_feature_extractor_test.py diff --git a/src/object_detection/models/ssd_mobilenet_v1_feature_extractor.py b/train/src/object_detection/models/ssd_mobilenet_v1_feature_extractor.py similarity index 100% rename from src/object_detection/models/ssd_mobilenet_v1_feature_extractor.py rename to train/src/object_detection/models/ssd_mobilenet_v1_feature_extractor.py diff --git a/src/object_detection/models/ssd_mobilenet_v1_feature_extractor_test.py b/train/src/object_detection/models/ssd_mobilenet_v1_feature_extractor_test.py similarity index 100% rename from src/object_detection/models/ssd_mobilenet_v1_feature_extractor_test.py rename to train/src/object_detection/models/ssd_mobilenet_v1_feature_extractor_test.py diff --git a/src/object_detection/object_detection_tutorial.ipynb b/train/src/object_detection/object_detection_tutorial.ipynb similarity index 100% rename from src/object_detection/object_detection_tutorial.ipynb rename to train/src/object_detection/object_detection_tutorial.ipynb diff --git a/src/object_detection/object_detection_tutorial.py b/train/src/object_detection/object_detection_tutorial.py similarity index 100% rename from src/object_detection/object_detection_tutorial.py rename to train/src/object_detection/object_detection_tutorial.py diff --git a/src/object_detection/protos/BUILD b/train/src/object_detection/protos/BUILD similarity index 100% rename from src/object_detection/protos/BUILD rename to train/src/object_detection/protos/BUILD diff --git a/train/src/object_detection/protos/__init__.py b/train/src/object_detection/protos/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/object_detection/protos/anchor_generator.proto b/train/src/object_detection/protos/anchor_generator.proto similarity index 100% rename from src/object_detection/protos/anchor_generator.proto rename to train/src/object_detection/protos/anchor_generator.proto diff --git a/src/object_detection/protos/anchor_generator_pb2.py b/train/src/object_detection/protos/anchor_generator_pb2.py similarity index 100% rename from src/object_detection/protos/anchor_generator_pb2.py rename to train/src/object_detection/protos/anchor_generator_pb2.py diff --git a/src/object_detection/protos/argmax_matcher.proto b/train/src/object_detection/protos/argmax_matcher.proto similarity index 100% rename from src/object_detection/protos/argmax_matcher.proto rename to train/src/object_detection/protos/argmax_matcher.proto diff --git a/src/object_detection/protos/argmax_matcher_pb2.py b/train/src/object_detection/protos/argmax_matcher_pb2.py similarity index 100% rename from src/object_detection/protos/argmax_matcher_pb2.py rename to train/src/object_detection/protos/argmax_matcher_pb2.py diff --git a/src/object_detection/protos/bipartite_matcher.proto b/train/src/object_detection/protos/bipartite_matcher.proto similarity index 100% rename from src/object_detection/protos/bipartite_matcher.proto rename to train/src/object_detection/protos/bipartite_matcher.proto diff --git a/src/object_detection/protos/bipartite_matcher_pb2.py b/train/src/object_detection/protos/bipartite_matcher_pb2.py similarity index 100% rename from src/object_detection/protos/bipartite_matcher_pb2.py rename to train/src/object_detection/protos/bipartite_matcher_pb2.py diff --git a/src/object_detection/protos/box_coder.proto b/train/src/object_detection/protos/box_coder.proto similarity index 100% rename from src/object_detection/protos/box_coder.proto rename to train/src/object_detection/protos/box_coder.proto diff --git a/src/object_detection/protos/box_coder_pb2.py b/train/src/object_detection/protos/box_coder_pb2.py similarity index 100% rename from src/object_detection/protos/box_coder_pb2.py rename to train/src/object_detection/protos/box_coder_pb2.py diff --git a/src/object_detection/protos/box_predictor.proto b/train/src/object_detection/protos/box_predictor.proto similarity index 100% rename from src/object_detection/protos/box_predictor.proto rename to train/src/object_detection/protos/box_predictor.proto diff --git a/src/object_detection/protos/box_predictor_pb2.py b/train/src/object_detection/protos/box_predictor_pb2.py similarity index 100% rename from src/object_detection/protos/box_predictor_pb2.py rename to train/src/object_detection/protos/box_predictor_pb2.py diff --git a/src/object_detection/protos/eval.proto b/train/src/object_detection/protos/eval.proto similarity index 100% rename from src/object_detection/protos/eval.proto rename to train/src/object_detection/protos/eval.proto diff --git a/src/object_detection/protos/eval_pb2.py b/train/src/object_detection/protos/eval_pb2.py similarity index 100% rename from src/object_detection/protos/eval_pb2.py rename to train/src/object_detection/protos/eval_pb2.py diff --git a/src/object_detection/protos/faster_rcnn.proto b/train/src/object_detection/protos/faster_rcnn.proto similarity index 100% rename from src/object_detection/protos/faster_rcnn.proto rename to train/src/object_detection/protos/faster_rcnn.proto diff --git a/src/object_detection/protos/faster_rcnn_box_coder.proto b/train/src/object_detection/protos/faster_rcnn_box_coder.proto similarity index 100% rename from src/object_detection/protos/faster_rcnn_box_coder.proto rename to train/src/object_detection/protos/faster_rcnn_box_coder.proto diff --git a/src/object_detection/protos/faster_rcnn_box_coder_pb2.py b/train/src/object_detection/protos/faster_rcnn_box_coder_pb2.py similarity index 100% rename from src/object_detection/protos/faster_rcnn_box_coder_pb2.py rename to train/src/object_detection/protos/faster_rcnn_box_coder_pb2.py diff --git a/src/object_detection/protos/faster_rcnn_pb2.py b/train/src/object_detection/protos/faster_rcnn_pb2.py similarity index 100% rename from src/object_detection/protos/faster_rcnn_pb2.py rename to train/src/object_detection/protos/faster_rcnn_pb2.py diff --git a/src/object_detection/protos/grid_anchor_generator.proto b/train/src/object_detection/protos/grid_anchor_generator.proto similarity index 100% rename from src/object_detection/protos/grid_anchor_generator.proto rename to train/src/object_detection/protos/grid_anchor_generator.proto diff --git a/src/object_detection/protos/grid_anchor_generator_pb2.py b/train/src/object_detection/protos/grid_anchor_generator_pb2.py similarity index 100% rename from src/object_detection/protos/grid_anchor_generator_pb2.py rename to train/src/object_detection/protos/grid_anchor_generator_pb2.py diff --git a/src/object_detection/protos/hyperparams.proto b/train/src/object_detection/protos/hyperparams.proto similarity index 100% rename from src/object_detection/protos/hyperparams.proto rename to train/src/object_detection/protos/hyperparams.proto diff --git a/src/object_detection/protos/hyperparams_pb2.py b/train/src/object_detection/protos/hyperparams_pb2.py similarity index 100% rename from src/object_detection/protos/hyperparams_pb2.py rename to train/src/object_detection/protos/hyperparams_pb2.py diff --git a/src/object_detection/protos/image_resizer.proto b/train/src/object_detection/protos/image_resizer.proto similarity index 100% rename from src/object_detection/protos/image_resizer.proto rename to train/src/object_detection/protos/image_resizer.proto diff --git a/src/object_detection/protos/image_resizer_pb2.py b/train/src/object_detection/protos/image_resizer_pb2.py similarity index 100% rename from src/object_detection/protos/image_resizer_pb2.py rename to train/src/object_detection/protos/image_resizer_pb2.py diff --git a/src/object_detection/protos/input_reader.proto b/train/src/object_detection/protos/input_reader.proto similarity index 100% rename from src/object_detection/protos/input_reader.proto rename to train/src/object_detection/protos/input_reader.proto diff --git a/src/object_detection/protos/input_reader_pb2.py b/train/src/object_detection/protos/input_reader_pb2.py similarity index 100% rename from src/object_detection/protos/input_reader_pb2.py rename to train/src/object_detection/protos/input_reader_pb2.py diff --git a/src/object_detection/protos/losses.proto b/train/src/object_detection/protos/losses.proto similarity index 100% rename from src/object_detection/protos/losses.proto rename to train/src/object_detection/protos/losses.proto diff --git a/src/object_detection/protos/losses_pb2.py b/train/src/object_detection/protos/losses_pb2.py similarity index 100% rename from src/object_detection/protos/losses_pb2.py rename to train/src/object_detection/protos/losses_pb2.py diff --git a/src/object_detection/protos/matcher.proto b/train/src/object_detection/protos/matcher.proto similarity index 100% rename from src/object_detection/protos/matcher.proto rename to train/src/object_detection/protos/matcher.proto diff --git a/src/object_detection/protos/matcher_pb2.py b/train/src/object_detection/protos/matcher_pb2.py similarity index 100% rename from src/object_detection/protos/matcher_pb2.py rename to train/src/object_detection/protos/matcher_pb2.py diff --git a/src/object_detection/protos/mean_stddev_box_coder.proto b/train/src/object_detection/protos/mean_stddev_box_coder.proto similarity index 100% rename from src/object_detection/protos/mean_stddev_box_coder.proto rename to train/src/object_detection/protos/mean_stddev_box_coder.proto diff --git a/src/object_detection/protos/mean_stddev_box_coder_pb2.py b/train/src/object_detection/protos/mean_stddev_box_coder_pb2.py similarity index 100% rename from src/object_detection/protos/mean_stddev_box_coder_pb2.py rename to train/src/object_detection/protos/mean_stddev_box_coder_pb2.py diff --git a/src/object_detection/protos/model.proto b/train/src/object_detection/protos/model.proto similarity index 100% rename from src/object_detection/protos/model.proto rename to train/src/object_detection/protos/model.proto diff --git a/src/object_detection/protos/model_pb2.py b/train/src/object_detection/protos/model_pb2.py similarity index 100% rename from src/object_detection/protos/model_pb2.py rename to train/src/object_detection/protos/model_pb2.py diff --git a/src/object_detection/protos/model_pb2.pyc b/train/src/object_detection/protos/model_pb2.pyc similarity index 100% rename from src/object_detection/protos/model_pb2.pyc rename to train/src/object_detection/protos/model_pb2.pyc diff --git a/src/object_detection/protos/optimizer.proto b/train/src/object_detection/protos/optimizer.proto similarity index 100% rename from src/object_detection/protos/optimizer.proto rename to train/src/object_detection/protos/optimizer.proto diff --git a/src/object_detection/protos/optimizer_pb2.py b/train/src/object_detection/protos/optimizer_pb2.py similarity index 100% rename from src/object_detection/protos/optimizer_pb2.py rename to train/src/object_detection/protos/optimizer_pb2.py diff --git a/src/object_detection/protos/pipeline.proto b/train/src/object_detection/protos/pipeline.proto similarity index 100% rename from src/object_detection/protos/pipeline.proto rename to train/src/object_detection/protos/pipeline.proto diff --git a/src/object_detection/protos/pipeline_pb2.py b/train/src/object_detection/protos/pipeline_pb2.py similarity index 100% rename from src/object_detection/protos/pipeline_pb2.py rename to train/src/object_detection/protos/pipeline_pb2.py diff --git a/src/object_detection/protos/post_processing.proto b/train/src/object_detection/protos/post_processing.proto similarity index 100% rename from src/object_detection/protos/post_processing.proto rename to train/src/object_detection/protos/post_processing.proto diff --git a/src/object_detection/protos/post_processing_pb2.py b/train/src/object_detection/protos/post_processing_pb2.py similarity index 100% rename from src/object_detection/protos/post_processing_pb2.py rename to train/src/object_detection/protos/post_processing_pb2.py diff --git a/src/object_detection/protos/preprocessor.proto b/train/src/object_detection/protos/preprocessor.proto similarity index 100% rename from src/object_detection/protos/preprocessor.proto rename to train/src/object_detection/protos/preprocessor.proto diff --git a/src/object_detection/protos/preprocessor_pb2.py b/train/src/object_detection/protos/preprocessor_pb2.py similarity index 100% rename from src/object_detection/protos/preprocessor_pb2.py rename to train/src/object_detection/protos/preprocessor_pb2.py diff --git a/src/object_detection/protos/region_similarity_calculator.proto b/train/src/object_detection/protos/region_similarity_calculator.proto similarity index 100% rename from src/object_detection/protos/region_similarity_calculator.proto rename to train/src/object_detection/protos/region_similarity_calculator.proto diff --git a/src/object_detection/protos/region_similarity_calculator_pb2.py b/train/src/object_detection/protos/region_similarity_calculator_pb2.py similarity index 100% rename from src/object_detection/protos/region_similarity_calculator_pb2.py rename to train/src/object_detection/protos/region_similarity_calculator_pb2.py diff --git a/src/object_detection/protos/square_box_coder.proto b/train/src/object_detection/protos/square_box_coder.proto similarity index 100% rename from src/object_detection/protos/square_box_coder.proto rename to train/src/object_detection/protos/square_box_coder.proto diff --git a/src/object_detection/protos/square_box_coder_pb2.py b/train/src/object_detection/protos/square_box_coder_pb2.py similarity index 100% rename from src/object_detection/protos/square_box_coder_pb2.py rename to train/src/object_detection/protos/square_box_coder_pb2.py diff --git a/src/object_detection/protos/ssd.proto b/train/src/object_detection/protos/ssd.proto similarity index 100% rename from src/object_detection/protos/ssd.proto rename to train/src/object_detection/protos/ssd.proto diff --git a/src/object_detection/protos/ssd_anchor_generator.proto b/train/src/object_detection/protos/ssd_anchor_generator.proto similarity index 100% rename from src/object_detection/protos/ssd_anchor_generator.proto rename to train/src/object_detection/protos/ssd_anchor_generator.proto diff --git a/src/object_detection/protos/ssd_anchor_generator_pb2.py b/train/src/object_detection/protos/ssd_anchor_generator_pb2.py similarity index 100% rename from src/object_detection/protos/ssd_anchor_generator_pb2.py rename to train/src/object_detection/protos/ssd_anchor_generator_pb2.py diff --git a/src/object_detection/protos/ssd_pb2.py b/train/src/object_detection/protos/ssd_pb2.py similarity index 100% rename from src/object_detection/protos/ssd_pb2.py rename to train/src/object_detection/protos/ssd_pb2.py diff --git a/train/src/object_detection/protos/string_int_label_map.proto b/train/src/object_detection/protos/string_int_label_map.proto new file mode 100644 index 0000000..0894183 --- /dev/null +++ b/train/src/object_detection/protos/string_int_label_map.proto @@ -0,0 +1,24 @@ +// Message to store the mapping from class label strings to class id. Datasets +// use string labels to represent classes while the object detection framework +// works with class ids. This message maps them so they can be converted back +// and forth as needed. +syntax = "proto2"; + +package object_detection.protos; + +message StringIntLabelMapItem { + // String name. The most common practice is to set this to a MID or synsets + // id. + optional string name = 1; + + // Integer id that maps to the string name above. Label ids should start from + // 1. + optional int32 id = 2; + + // Human readable string label. + optional string display_name = 3; +}; + +message StringIntLabelMap { + repeated StringIntLabelMapItem item = 1; +}; diff --git a/train/src/object_detection/protos/string_int_label_map_pb2.py b/train/src/object_detection/protos/string_int_label_map_pb2.py new file mode 100644 index 0000000..1556736 --- /dev/null +++ b/train/src/object_detection/protos/string_int_label_map_pb2.py @@ -0,0 +1,123 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: object_detection/protos/string_int_label_map.proto + +import sys +_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +from google.protobuf import descriptor_pb2 +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='object_detection/protos/string_int_label_map.proto', + package='object_detection.protos', + syntax='proto2', + serialized_pb=_b('\n2object_detection/protos/string_int_label_map.proto\x12\x17object_detection.protos\"G\n\x15StringIntLabelMapItem\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\n\n\x02id\x18\x02 \x01(\x05\x12\x14\n\x0c\x64isplay_name\x18\x03 \x01(\t\"Q\n\x11StringIntLabelMap\x12<\n\x04item\x18\x01 \x03(\x0b\x32..object_detection.protos.StringIntLabelMapItem') +) + + + + +_STRINGINTLABELMAPITEM = _descriptor.Descriptor( + name='StringIntLabelMapItem', + full_name='object_detection.protos.StringIntLabelMapItem', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='name', full_name='object_detection.protos.StringIntLabelMapItem.name', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='id', full_name='object_detection.protos.StringIntLabelMapItem.id', index=1, + number=2, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='display_name', full_name='object_detection.protos.StringIntLabelMapItem.display_name', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=79, + serialized_end=150, +) + + +_STRINGINTLABELMAP = _descriptor.Descriptor( + name='StringIntLabelMap', + full_name='object_detection.protos.StringIntLabelMap', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='item', full_name='object_detection.protos.StringIntLabelMap.item', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=152, + serialized_end=233, +) + +_STRINGINTLABELMAP.fields_by_name['item'].message_type = _STRINGINTLABELMAPITEM +DESCRIPTOR.message_types_by_name['StringIntLabelMapItem'] = _STRINGINTLABELMAPITEM +DESCRIPTOR.message_types_by_name['StringIntLabelMap'] = _STRINGINTLABELMAP +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +StringIntLabelMapItem = _reflection.GeneratedProtocolMessageType('StringIntLabelMapItem', (_message.Message,), dict( + DESCRIPTOR = _STRINGINTLABELMAPITEM, + __module__ = 'object_detection.protos.string_int_label_map_pb2' + # @@protoc_insertion_point(class_scope:object_detection.protos.StringIntLabelMapItem) + )) +_sym_db.RegisterMessage(StringIntLabelMapItem) + +StringIntLabelMap = _reflection.GeneratedProtocolMessageType('StringIntLabelMap', (_message.Message,), dict( + DESCRIPTOR = _STRINGINTLABELMAP, + __module__ = 'object_detection.protos.string_int_label_map_pb2' + # @@protoc_insertion_point(class_scope:object_detection.protos.StringIntLabelMap) + )) +_sym_db.RegisterMessage(StringIntLabelMap) + + +# @@protoc_insertion_point(module_scope) diff --git a/src/object_detection/protos/train.proto b/train/src/object_detection/protos/train.proto similarity index 100% rename from src/object_detection/protos/train.proto rename to train/src/object_detection/protos/train.proto diff --git a/src/object_detection/protos/train_pb2.py b/train/src/object_detection/protos/train_pb2.py similarity index 100% rename from src/object_detection/protos/train_pb2.py rename to train/src/object_detection/protos/train_pb2.py diff --git a/src/object_detection/samples/cloud/cloud.yml b/train/src/object_detection/samples/cloud/cloud.yml similarity index 100% rename from src/object_detection/samples/cloud/cloud.yml rename to train/src/object_detection/samples/cloud/cloud.yml diff --git a/src/object_detection/samples/configs/faster_rcnn_inception_resnet_v2_atrous_pets.config b/train/src/object_detection/samples/configs/faster_rcnn_inception_resnet_v2_atrous_pets.config similarity index 100% rename from src/object_detection/samples/configs/faster_rcnn_inception_resnet_v2_atrous_pets.config rename to train/src/object_detection/samples/configs/faster_rcnn_inception_resnet_v2_atrous_pets.config diff --git a/src/object_detection/samples/configs/faster_rcnn_resnet101_pets.config b/train/src/object_detection/samples/configs/faster_rcnn_resnet101_pets.config similarity index 100% rename from src/object_detection/samples/configs/faster_rcnn_resnet101_pets.config rename to train/src/object_detection/samples/configs/faster_rcnn_resnet101_pets.config diff --git a/src/object_detection/samples/configs/faster_rcnn_resnet101_voc07.config b/train/src/object_detection/samples/configs/faster_rcnn_resnet101_voc07.config similarity index 100% rename from src/object_detection/samples/configs/faster_rcnn_resnet101_voc07.config rename to train/src/object_detection/samples/configs/faster_rcnn_resnet101_voc07.config diff --git a/src/object_detection/samples/configs/faster_rcnn_resnet152_pets.config b/train/src/object_detection/samples/configs/faster_rcnn_resnet152_pets.config similarity index 100% rename from src/object_detection/samples/configs/faster_rcnn_resnet152_pets.config rename to train/src/object_detection/samples/configs/faster_rcnn_resnet152_pets.config diff --git a/src/object_detection/samples/configs/faster_rcnn_resnet50_pets.config b/train/src/object_detection/samples/configs/faster_rcnn_resnet50_pets.config similarity index 100% rename from src/object_detection/samples/configs/faster_rcnn_resnet50_pets.config rename to train/src/object_detection/samples/configs/faster_rcnn_resnet50_pets.config diff --git a/src/object_detection/samples/configs/rfcn_resnet101_pets.config b/train/src/object_detection/samples/configs/rfcn_resnet101_pets.config similarity index 100% rename from src/object_detection/samples/configs/rfcn_resnet101_pets.config rename to train/src/object_detection/samples/configs/rfcn_resnet101_pets.config diff --git a/src/object_detection/samples/configs/ssd_inception_v2_pets.config b/train/src/object_detection/samples/configs/ssd_inception_v2_pets.config similarity index 100% rename from src/object_detection/samples/configs/ssd_inception_v2_pets.config rename to train/src/object_detection/samples/configs/ssd_inception_v2_pets.config diff --git a/src/object_detection/samples/configs/ssd_mobilenet_v1_pets.config b/train/src/object_detection/samples/configs/ssd_mobilenet_v1_pets.config similarity index 100% rename from src/object_detection/samples/configs/ssd_mobilenet_v1_pets.config rename to train/src/object_detection/samples/configs/ssd_mobilenet_v1_pets.config diff --git a/src/object_detection/test_images/Screenshot from 2017-07-06 16:36:56.png b/train/src/object_detection/test_images/Screenshot from 2017-07-06 16:36:56.png similarity index 100% rename from src/object_detection/test_images/Screenshot from 2017-07-06 16:36:56.png rename to train/src/object_detection/test_images/Screenshot from 2017-07-06 16:36:56.png diff --git a/src/object_detection/test_images/image1.jpg b/train/src/object_detection/test_images/image1.jpg similarity index 100% rename from src/object_detection/test_images/image1.jpg rename to train/src/object_detection/test_images/image1.jpg diff --git a/src/object_detection/test_images/image1.png b/train/src/object_detection/test_images/image1.png similarity index 100% rename from src/object_detection/test_images/image1.png rename to train/src/object_detection/test_images/image1.png diff --git a/src/object_detection/test_images/image2.jpg b/train/src/object_detection/test_images/image2.jpg similarity index 100% rename from src/object_detection/test_images/image2.jpg rename to train/src/object_detection/test_images/image2.jpg diff --git a/src/object_detection/test_images/image2.png b/train/src/object_detection/test_images/image2.png similarity index 100% rename from src/object_detection/test_images/image2.png rename to train/src/object_detection/test_images/image2.png diff --git a/src/object_detection/test_images/image3.jpg b/train/src/object_detection/test_images/image3.jpg similarity index 100% rename from src/object_detection/test_images/image3.jpg rename to train/src/object_detection/test_images/image3.jpg diff --git a/src/object_detection/test_images/image3.png b/train/src/object_detection/test_images/image3.png similarity index 100% rename from src/object_detection/test_images/image3.png rename to train/src/object_detection/test_images/image3.png diff --git a/src/object_detection/test_images/image4.jpg b/train/src/object_detection/test_images/image4.jpg similarity index 100% rename from src/object_detection/test_images/image4.jpg rename to train/src/object_detection/test_images/image4.jpg diff --git a/src/object_detection/test_images/image5.jpg b/train/src/object_detection/test_images/image5.jpg similarity index 100% rename from src/object_detection/test_images/image5.jpg rename to train/src/object_detection/test_images/image5.jpg diff --git a/src/object_detection/test_images/image55.jpg b/train/src/object_detection/test_images/image55.jpg similarity index 100% rename from src/object_detection/test_images/image55.jpg rename to train/src/object_detection/test_images/image55.jpg diff --git a/src/object_detection/test_images/image6.jpg b/train/src/object_detection/test_images/image6.jpg similarity index 100% rename from src/object_detection/test_images/image6.jpg rename to train/src/object_detection/test_images/image6.jpg diff --git a/src/object_detection/test_images/image_info.txt b/train/src/object_detection/test_images/image_info.txt similarity index 100% rename from src/object_detection/test_images/image_info.txt rename to train/src/object_detection/test_images/image_info.txt diff --git a/src/object_detection/testcamera.py b/train/src/object_detection/testcamera.py similarity index 100% rename from src/object_detection/testcamera.py rename to train/src/object_detection/testcamera.py diff --git a/src/object_detection/train.py b/train/src/object_detection/train.py similarity index 100% rename from src/object_detection/train.py rename to train/src/object_detection/train.py diff --git a/src/object_detection/trainer.py b/train/src/object_detection/trainer.py similarity index 100% rename from src/object_detection/trainer.py rename to train/src/object_detection/trainer.py diff --git a/src/object_detection/trainer_test.py b/train/src/object_detection/trainer_test.py similarity index 100% rename from src/object_detection/trainer_test.py rename to train/src/object_detection/trainer_test.py diff --git a/src/object_detection/utils/BUILD b/train/src/object_detection/utils/BUILD similarity index 100% rename from src/object_detection/utils/BUILD rename to train/src/object_detection/utils/BUILD diff --git a/train/src/object_detection/utils/__init__.py b/train/src/object_detection/utils/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/object_detection/utils/category_util.py b/train/src/object_detection/utils/category_util.py similarity index 100% rename from src/object_detection/utils/category_util.py rename to train/src/object_detection/utils/category_util.py diff --git a/src/object_detection/utils/category_util_test.py b/train/src/object_detection/utils/category_util_test.py similarity index 100% rename from src/object_detection/utils/category_util_test.py rename to train/src/object_detection/utils/category_util_test.py diff --git a/src/object_detection/utils/dataset_util.py b/train/src/object_detection/utils/dataset_util.py similarity index 100% rename from src/object_detection/utils/dataset_util.py rename to train/src/object_detection/utils/dataset_util.py diff --git a/src/object_detection/utils/dataset_util_test.py b/train/src/object_detection/utils/dataset_util_test.py similarity index 100% rename from src/object_detection/utils/dataset_util_test.py rename to train/src/object_detection/utils/dataset_util_test.py diff --git a/train/src/object_detection/utils/label_map_util.py b/train/src/object_detection/utils/label_map_util.py new file mode 100644 index 0000000..3b8857c --- /dev/null +++ b/train/src/object_detection/utils/label_map_util.py @@ -0,0 +1,140 @@ +# Copyright 2017 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== + +"""Label map utility functions.""" + +import logging + +import tensorflow as tf +from google.protobuf import text_format +from object_detection.protos import string_int_label_map_pb2 + + +def _validate_label_map(label_map): + """Checks if a label map is valid. + + Args: + label_map: StringIntLabelMap to validate. + + Raises: + ValueError: if label map is invalid. + """ + for item in label_map.item: + if item.id < 1: + raise ValueError('Label map ids should be >= 1.') + + +def create_category_index(categories): + """Creates dictionary of COCO compatible categories keyed by category id. + + Args: + categories: a list of dicts, each of which has the following keys: + 'id': (required) an integer id uniquely identifying this category. + 'name': (required) string representing category name + e.g., 'cat', 'dog', 'pizza'. + + Returns: + category_index: a dict containing the same entries as categories, but keyed + by the 'id' field of each category. + """ + category_index = {} + for cat in categories: + category_index[cat['id']] = cat + return category_index + + +def convert_label_map_to_categories(label_map, + max_num_classes, + use_display_name=True): + """Loads label map proto and returns categories list compatible with eval. + + This function loads a label map and returns a list of dicts, each of which + has the following keys: + 'id': (required) an integer id uniquely identifying this category. + 'name': (required) string representing category name + e.g., 'cat', 'dog', 'pizza'. + We only allow class into the list if its id-label_id_offset is + between 0 (inclusive) and max_num_classes (exclusive). + If there are several items mapping to the same id in the label map, + we will only keep the first one in the categories list. + + Args: + label_map: a StringIntLabelMapProto or None. If None, a default categories + list is created with max_num_classes categories. + max_num_classes: maximum number of (consecutive) label indices to include. + use_display_name: (boolean) choose whether to load 'display_name' field + as category name. If False or if the display_name field does not exist, + uses 'name' field as category names instead. + Returns: + categories: a list of dictionaries representing all possible categories. + """ + categories = [] + list_of_ids_already_added = [] + if not label_map: + label_id_offset = 1 + for class_id in range(max_num_classes): + categories.append({ + 'id': class_id + label_id_offset, + 'name': 'category_{}'.format(class_id + label_id_offset) + }) + return categories + for item in label_map.item: + if not 0 < item.id <= max_num_classes: + logging.info('Ignore item %d since it falls outside of requested ' + 'label range.', item.id) + continue + if use_display_name and item.HasField('display_name'): + name = item.display_name + else: + name = item.name + if item.id not in list_of_ids_already_added: + list_of_ids_already_added.append(item.id) + categories.append({'id': item.id, 'name': name}) + return categories + + +def load_labelmap(path): + """Loads label map proto. + + Args: + path: path to StringIntLabelMap proto text file. + Returns: + a StringIntLabelMapProto + """ + with tf.gfile.GFile(path, 'r') as fid: + label_map_string = fid.read() + label_map = string_int_label_map_pb2.StringIntLabelMap() + try: + text_format.Merge(label_map_string, label_map) + except text_format.ParseError: + label_map.ParseFromString(label_map_string) + _validate_label_map(label_map) + return label_map + + +def get_label_map_dict(label_map_path): + """Reads a label map and returns a dictionary of label names to id. + + Args: + label_map_path: path to label_map. + + Returns: + A dictionary mapping label names to id. + """ + label_map = load_labelmap(label_map_path) + label_map_dict = {} + for item in label_map.item: + label_map_dict[item.name] = item.id + return label_map_dict diff --git a/src/object_detection/utils/label_map_util_test.py b/train/src/object_detection/utils/label_map_util_test.py similarity index 100% rename from src/object_detection/utils/label_map_util_test.py rename to train/src/object_detection/utils/label_map_util_test.py diff --git a/src/object_detection/utils/learning_schedules.py b/train/src/object_detection/utils/learning_schedules.py similarity index 100% rename from src/object_detection/utils/learning_schedules.py rename to train/src/object_detection/utils/learning_schedules.py diff --git a/src/object_detection/utils/learning_schedules_test.py b/train/src/object_detection/utils/learning_schedules_test.py similarity index 100% rename from src/object_detection/utils/learning_schedules_test.py rename to train/src/object_detection/utils/learning_schedules_test.py diff --git a/src/object_detection/utils/metrics.py b/train/src/object_detection/utils/metrics.py similarity index 100% rename from src/object_detection/utils/metrics.py rename to train/src/object_detection/utils/metrics.py diff --git a/src/object_detection/utils/metrics_test.py b/train/src/object_detection/utils/metrics_test.py similarity index 100% rename from src/object_detection/utils/metrics_test.py rename to train/src/object_detection/utils/metrics_test.py diff --git a/src/object_detection/utils/np_box_list.py b/train/src/object_detection/utils/np_box_list.py similarity index 100% rename from src/object_detection/utils/np_box_list.py rename to train/src/object_detection/utils/np_box_list.py diff --git a/src/object_detection/utils/np_box_list_ops.py b/train/src/object_detection/utils/np_box_list_ops.py similarity index 100% rename from src/object_detection/utils/np_box_list_ops.py rename to train/src/object_detection/utils/np_box_list_ops.py diff --git a/src/object_detection/utils/np_box_list_ops_test.py b/train/src/object_detection/utils/np_box_list_ops_test.py similarity index 100% rename from src/object_detection/utils/np_box_list_ops_test.py rename to train/src/object_detection/utils/np_box_list_ops_test.py diff --git a/src/object_detection/utils/np_box_list_test.py b/train/src/object_detection/utils/np_box_list_test.py similarity index 100% rename from src/object_detection/utils/np_box_list_test.py rename to train/src/object_detection/utils/np_box_list_test.py diff --git a/src/object_detection/utils/np_box_ops.py b/train/src/object_detection/utils/np_box_ops.py similarity index 100% rename from src/object_detection/utils/np_box_ops.py rename to train/src/object_detection/utils/np_box_ops.py diff --git a/src/object_detection/utils/np_box_ops_test.py b/train/src/object_detection/utils/np_box_ops_test.py similarity index 100% rename from src/object_detection/utils/np_box_ops_test.py rename to train/src/object_detection/utils/np_box_ops_test.py diff --git a/src/object_detection/utils/object_detection_evaluation.py b/train/src/object_detection/utils/object_detection_evaluation.py similarity index 100% rename from src/object_detection/utils/object_detection_evaluation.py rename to train/src/object_detection/utils/object_detection_evaluation.py diff --git a/src/object_detection/utils/object_detection_evaluation_test.py b/train/src/object_detection/utils/object_detection_evaluation_test.py similarity index 100% rename from src/object_detection/utils/object_detection_evaluation_test.py rename to train/src/object_detection/utils/object_detection_evaluation_test.py diff --git a/src/object_detection/utils/ops.py b/train/src/object_detection/utils/ops.py similarity index 100% rename from src/object_detection/utils/ops.py rename to train/src/object_detection/utils/ops.py diff --git a/src/object_detection/utils/ops_test.py b/train/src/object_detection/utils/ops_test.py similarity index 100% rename from src/object_detection/utils/ops_test.py rename to train/src/object_detection/utils/ops_test.py diff --git a/src/object_detection/utils/per_image_evaluation.py b/train/src/object_detection/utils/per_image_evaluation.py similarity index 100% rename from src/object_detection/utils/per_image_evaluation.py rename to train/src/object_detection/utils/per_image_evaluation.py diff --git a/src/object_detection/utils/per_image_evaluation_test.py b/train/src/object_detection/utils/per_image_evaluation_test.py similarity index 100% rename from src/object_detection/utils/per_image_evaluation_test.py rename to train/src/object_detection/utils/per_image_evaluation_test.py diff --git a/src/object_detection/utils/shape_utils.py b/train/src/object_detection/utils/shape_utils.py similarity index 100% rename from src/object_detection/utils/shape_utils.py rename to train/src/object_detection/utils/shape_utils.py diff --git a/src/object_detection/utils/shape_utils_test.py b/train/src/object_detection/utils/shape_utils_test.py similarity index 100% rename from src/object_detection/utils/shape_utils_test.py rename to train/src/object_detection/utils/shape_utils_test.py diff --git a/src/object_detection/utils/static_shape.py b/train/src/object_detection/utils/static_shape.py similarity index 100% rename from src/object_detection/utils/static_shape.py rename to train/src/object_detection/utils/static_shape.py diff --git a/src/object_detection/utils/static_shape_test.py b/train/src/object_detection/utils/static_shape_test.py similarity index 100% rename from src/object_detection/utils/static_shape_test.py rename to train/src/object_detection/utils/static_shape_test.py diff --git a/src/object_detection/utils/test_utils.py b/train/src/object_detection/utils/test_utils.py similarity index 100% rename from src/object_detection/utils/test_utils.py rename to train/src/object_detection/utils/test_utils.py diff --git a/src/object_detection/utils/test_utils_test.py b/train/src/object_detection/utils/test_utils_test.py similarity index 100% rename from src/object_detection/utils/test_utils_test.py rename to train/src/object_detection/utils/test_utils_test.py diff --git a/src/object_detection/utils/variables_helper.py b/train/src/object_detection/utils/variables_helper.py similarity index 100% rename from src/object_detection/utils/variables_helper.py rename to train/src/object_detection/utils/variables_helper.py diff --git a/src/object_detection/utils/variables_helper_test.py b/train/src/object_detection/utils/variables_helper_test.py similarity index 100% rename from src/object_detection/utils/variables_helper_test.py rename to train/src/object_detection/utils/variables_helper_test.py diff --git a/train/src/object_detection/utils/visualization_utils.py b/train/src/object_detection/utils/visualization_utils.py new file mode 100644 index 0000000..3c2c4b1 --- /dev/null +++ b/train/src/object_detection/utils/visualization_utils.py @@ -0,0 +1,451 @@ +# Copyright 2017 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== + +"""A set of functions that are used for visualization. + +These functions often receive an image, perform some visualization on the image. +The functions do not return a value, instead they modify the image itself. + +""" +import collections +import numpy as np +import PIL.Image as Image +import PIL.ImageColor as ImageColor +import PIL.ImageDraw as ImageDraw +import PIL.ImageFont as ImageFont +import six +import tensorflow as tf + + +_TITLE_LEFT_MARGIN = 10 +_TITLE_TOP_MARGIN = 10 +STANDARD_COLORS = [ + 'AliceBlue', 'Chartreuse', 'Aqua', 'Aquamarine', 'Azure', 'Beige', 'Bisque', + 'BlanchedAlmond', 'BlueViolet', 'BurlyWood', 'CadetBlue', 'AntiqueWhite', + 'Chocolate', 'Coral', 'CornflowerBlue', 'Cornsilk', 'Crimson', 'Cyan', + 'DarkCyan', 'DarkGoldenRod', 'DarkGrey', 'DarkKhaki', 'DarkOrange', + 'DarkOrchid', 'DarkSalmon', 'DarkSeaGreen', 'DarkTurquoise', 'DarkViolet', + 'DeepPink', 'DeepSkyBlue', 'DodgerBlue', 'FireBrick', 'FloralWhite', + 'ForestGreen', 'Fuchsia', 'Gainsboro', 'GhostWhite', 'Gold', 'GoldenRod', + 'Salmon', 'Tan', 'HoneyDew', 'HotPink', 'IndianRed', 'Ivory', 'Khaki', + 'Lavender', 'LavenderBlush', 'LawnGreen', 'LemonChiffon', 'LightBlue', + 'LightCoral', 'LightCyan', 'LightGoldenRodYellow', 'LightGray', 'LightGrey', + 'LightGreen', 'LightPink', 'LightSalmon', 'LightSeaGreen', 'LightSkyBlue', + 'LightSlateGray', 'LightSlateGrey', 'LightSteelBlue', 'LightYellow', 'Lime', + 'LimeGreen', 'Linen', 'Magenta', 'MediumAquaMarine', 'MediumOrchid', + 'MediumPurple', 'MediumSeaGreen', 'MediumSlateBlue', 'MediumSpringGreen', + 'MediumTurquoise', 'MediumVioletRed', 'MintCream', 'MistyRose', 'Moccasin', + 'NavajoWhite', 'OldLace', 'Olive', 'OliveDrab', 'Orange', 'OrangeRed', + 'Orchid', 'PaleGoldenRod', 'PaleGreen', 'PaleTurquoise', 'PaleVioletRed', + 'PapayaWhip', 'PeachPuff', 'Peru', 'Pink', 'Plum', 'PowderBlue', 'Purple', + 'Red', 'RosyBrown', 'RoyalBlue', 'SaddleBrown', 'Green', 'SandyBrown', + 'SeaGreen', 'SeaShell', 'Sienna', 'Silver', 'SkyBlue', 'SlateBlue', + 'SlateGray', 'SlateGrey', 'Snow', 'SpringGreen', 'SteelBlue', 'GreenYellow', + 'Teal', 'Thistle', 'Tomato', 'Turquoise', 'Violet', 'Wheat', 'White', + 'WhiteSmoke', 'Yellow', 'YellowGreen' +] + + +def save_image_array_as_png(image, output_path): + """Saves an image (represented as a numpy array) to PNG. + + Args: + image: a numpy array with shape [height, width, 3]. + output_path: path to which image should be written. + """ + image_pil = Image.fromarray(np.uint8(image)).convert('RGB') + with tf.gfile.Open(output_path, 'w') as fid: + image_pil.save(fid, 'PNG') + + +def encode_image_array_as_png_str(image): + """Encodes a numpy array into a PNG string. + + Args: + image: a numpy array with shape [height, width, 3]. + + Returns: + PNG encoded image string. + """ + image_pil = Image.fromarray(np.uint8(image)) + output = six.BytesIO() + image_pil.save(output, format='PNG') + png_string = output.getvalue() + output.close() + return png_string + + +def draw_bounding_box_on_image_array(image, + ymin, + xmin, + ymax, + xmax, + color='red', + thickness=4, + display_str_list=(), + use_normalized_coordinates=True): + """Adds a bounding box to an image (numpy array). + + Args: + image: a numpy array with shape [height, width, 3]. + ymin: ymin of bounding box in normalized coordinates (same below). + xmin: xmin of bounding box. + ymax: ymax of bounding box. + xmax: xmax of bounding box. + color: color to draw bounding box. Default is red. + thickness: line thickness. Default value is 4. + display_str_list: list of strings to display in box + (each to be shown on its own line). + use_normalized_coordinates: If True (default), treat coordinates + ymin, xmin, ymax, xmax as relative to the image. Otherwise treat + coordinates as absolute. + """ + image_pil = Image.fromarray(np.uint8(image)).convert('RGB') + draw_bounding_box_on_image(image_pil, ymin, xmin, ymax, xmax, color, + thickness, display_str_list, + use_normalized_coordinates) + np.copyto(image, np.array(image_pil)) + + +def draw_bounding_box_on_image(image, + ymin, + xmin, + ymax, + xmax, + color='red', + thickness=4, + display_str_list=(), + use_normalized_coordinates=True): + """Adds a bounding box to an image. + + Each string in display_str_list is displayed on a separate line above the + bounding box in black text on a rectangle filled with the input 'color'. + + Args: + image: a PIL.Image object. + ymin: ymin of bounding box. + xmin: xmin of bounding box. + ymax: ymax of bounding box. + xmax: xmax of bounding box. + color: color to draw bounding box. Default is red. + thickness: line thickness. Default value is 4. + display_str_list: list of strings to display in box + (each to be shown on its own line). + use_normalized_coordinates: If True (default), treat coordinates + ymin, xmin, ymax, xmax as relative to the image. Otherwise treat + coordinates as absolute. + """ + box=[xmin, xmax, ymin, ymax] + draw = ImageDraw.Draw(image) + im_width, im_height = image.size + # print(image.size) + if use_normalized_coordinates: + (left, right, top, bottom) = (xmin * im_width, xmax * im_width, + ymin * im_height, ymax * im_height) + + # print ("xmin :%f, xmax: %f, ymin :%f, ymax :%f " %(xmin,xmax,ymin,ymax)) + # print ("left:%f, right: %f, top:%f, bottom :%f " %(left,right,top,bottom)) + # print ("center :( %d , %d)" %((left+right)/2,(top+bottom)/2)) + + else: + (left, right, top, bottom) = (xmin, xmax, ymin, ymax) + draw.line([(left, top), (left, bottom), (right, bottom), + (right, top), (left, top)], width=thickness, fill=color) + try: + font = ImageFont.truetype('arial.ttf', 24) + except IOError: + font = ImageFont.load_default() + + text_bottom = top + # Reverse list and print from bottom to top. + for display_str in display_str_list[::-1]: + text_width, text_height = font.getsize(display_str) + margin = np.ceil(0.05 * text_height) + draw.rectangle( + [(left, text_bottom - text_height - 2 * margin), (left + text_width, + text_bottom)], + fill=color) + draw.text( + (left + margin, text_bottom - text_height - margin), + display_str, + fill='black', + font=font) + text_bottom -= text_height - 2 * margin + # display_name=display_str.split(":",1) + # class_name=str(display_name[0]) + # score=int(display_name[1].split("%",1)[0]) + # print("Class: %s , Score: %d" %(class_name,score)) + + +def draw_bounding_boxes_on_image_array(image, + boxes, + color='red', + thickness=4, + display_str_list_list=()): + """Draws bounding boxes on image (numpy array). + + Args: + image: a numpy array object. + boxes: a 2 dimensional numpy array of [N, 4]: (ymin, xmin, ymax, xmax). + The coordinates are in normalized format between [0, 1]. + color: color to draw bounding box. Default is red. + thickness: line thickness. Default value is 4. + display_str_list_list: list of list of strings. + a list of strings for each bounding box. + The reason to pass a list of strings for a + bounding box is that it might contain + multiple labels. + + Raises: + ValueError: if boxes is not a [N, 4] array + """ + image_pil = Image.fromarray(image) + draw_bounding_boxes_on_image(image_pil, boxes, color, thickness, + display_str_list_list) + np.copyto(image, np.array(image_pil)) + + +def draw_bounding_boxes_on_image(image, + boxes, + color='red', + thickness=4, + display_str_list_list=()): + """Draws bounding boxes on image. + + Args: + image: a PIL.Image object. + boxes: a 2 dimensional numpy array of [N, 4]: (ymin, xmin, ymax, xmax). + The coordinates are in normalized format between [0, 1]. + color: color to draw bounding box. Default is red. + thickness: line thickness. Default value is 4. + display_str_list_list: list of list of strings. + a list of strings for each bounding box. + The reason to pass a list of strings for a + bounding box is that it might contain + multiple labels. + + Raises: + ValueError: if boxes is not a [N, 4] array + """ + boxes_shape = boxes.shape + if not boxes_shape: + return + if len(boxes_shape) != 2 or boxes_shape[1] != 4: + raise ValueError('Input must be of size [N, 4]') + for i in range(boxes_shape[0]): + display_str_list = () + if display_str_list_list: + display_str_list = display_str_list_list[i] + draw_bounding_box_on_image(image, boxes[i, 0], boxes[i, 1], boxes[i, 2], + boxes[i, 3], color, thickness, display_str_list) + + +def draw_keypoints_on_image_array(image, + keypoints, + color='red', + radius=2, + use_normalized_coordinates=True): + """Draws keypoints on an image (numpy array). + + Args: + image: a numpy array with shape [height, width, 3]. + keypoints: a numpy array with shape [num_keypoints, 2]. + color: color to draw the keypoints with. Default is red. + radius: keypoint radius. Default value is 2. + use_normalized_coordinates: if True (default), treat keypoint values as + relative to the image. Otherwise treat them as absolute. + """ + image_pil = Image.fromarray(np.uint8(image)).convert('RGB') + draw_keypoints_on_image(image_pil, keypoints, color, radius, + use_normalized_coordinates) + np.copyto(image, np.array(image_pil)) + + +def draw_keypoints_on_image(image, + keypoints, + color='red', + radius=2, + use_normalized_coordinates=True): + """Draws keypoints on an image. + + Args: + image: a PIL.Image object. + keypoints: a numpy array with shape [num_keypoints, 2]. + color: color to draw the keypoints with. Default is red. + radius: keypoint radius. Default value is 2. + use_normalized_coordinates: if True (default), treat keypoint values as + relative to the image. Otherwise treat them as absolute. + """ + draw = ImageDraw.Draw(image) + im_width, im_height = image.size + keypoints_x = [k[1] for k in keypoints] + keypoints_y = [k[0] for k in keypoints] + if use_normalized_coordinates: + keypoints_x = tuple([im_width * x for x in keypoints_x]) + keypoints_y = tuple([im_height * y for y in keypoints_y]) + for keypoint_x, keypoint_y in zip(keypoints_x, keypoints_y): + draw.ellipse([(keypoint_x - radius, keypoint_y - radius), + (keypoint_x + radius, keypoint_y + radius)], + outline=color, fill=color) + + +def draw_mask_on_image_array(image, mask, color='red', alpha=0.7): + """Draws mask on an image. + + Args: + image: uint8 numpy array with shape (img_height, img_height, 3) + mask: a float numpy array of shape (img_height, img_height) with + values between 0 and 1 + color: color to draw the keypoints with. Default is red. + alpha: transparency value between 0 and 1. (default: 0.7) + + Raises: + ValueError: On incorrect data type for image or masks. + """ + if image.dtype != np.uint8: + raise ValueError('`image` not of type np.uint8') + if mask.dtype != np.float32: + raise ValueError('`mask` not of type np.float32') + if np.any(np.logical_or(mask > 1.0, mask < 0.0)): + raise ValueError('`mask` elements should be in [0, 1]') + rgb = ImageColor.getrgb(color) + pil_image = Image.fromarray(image) + + solid_color = np.expand_dims( + np.ones_like(mask), axis=2) * np.reshape(list(rgb), [1, 1, 3]) + pil_solid_color = Image.fromarray(np.uint8(solid_color)).convert('RGBA') + pil_mask = Image.fromarray(np.uint8(255.0*alpha*mask)).convert('L') + pil_image = Image.composite(pil_solid_color, pil_image, pil_mask) + np.copyto(image, np.array(pil_image.convert('RGB'))) + + +def visualize_boxes_and_labels_on_image_array(image, + boxes, + classes, + scores, + category_index, + instance_masks=None, + keypoints=None, + use_normalized_coordinates=False, + max_boxes_to_draw=20, + min_score_thresh=.5, + agnostic_mode=False, + line_thickness=4): + """Overlay labeled boxes on an image with formatted scores and label names. + + This function groups boxes that correspond to the same location + and creates a display string for each detection and overlays these + on the image. Note that this function modifies the image array in-place + and does not return anything. + + Args: + image: uint8 numpy array with shape (img_height, img_width, 3) + boxes: a numpy array of shape [N, 4] + classes: a numpy array of shape [N] + scores: a numpy array of shape [N] or None. If scores=None, then + this function assumes that the boxes to be plotted are groundtruth + boxes and plot all boxes as black with no classes or scores. + category_index: a dict containing category dictionaries (each holding + category index `id` and category name `name`) keyed by category indices. + instance_masks: a numpy array of shape [N, image_height, image_width], can + be None + keypoints: a numpy array of shape [N, num_keypoints, 2], can + be None + use_normalized_coordinates: whether boxes is to be interpreted as + normalized coordinates or not. + max_boxes_to_draw: maximum number of boxes to visualize. If None, draw + all boxes. + min_score_thresh: minimum score threshold for a box to be visualized + agnostic_mode: boolean (default: False) controlling whether to evaluate in + class-agnostic mode or not. This mode will display scores but ignore + classes. + line_thickness: integer (default: 4) controlling line width of the boxes. + """ + # Create a display string (and color) for every box location, group any boxes + # that correspond to the same location. + # print(image.size) + box_to_display_str_map = collections.defaultdict(list) + box_to_ID_score=collections.defaultdict(list) + box_to_color_map = collections.defaultdict(str) + box_to_instance_masks_map = {} + box_to_keypoints_map = collections.defaultdict(list) + # a=0 + data = [] + if not max_boxes_to_draw: + max_boxes_to_draw = boxes.shape[0] + for i in range(min(max_boxes_to_draw, boxes.shape[0])): + if scores is None or scores[i] > min_score_thresh: + box = tuple(boxes[i].tolist()) + + if instance_masks is not None: + box_to_instance_masks_map[box] = instance_masks[i] + if keypoints is not None: + box_to_keypoints_map[box].extend(keypoints[i]) + if scores is None: + box_to_color_map[box] = 'black' + else: + if not agnostic_mode: + if classes[i] in category_index.keys(): + class_name = category_index[classes[i]]['name'] + class_id = category_index[classes[i]]['id'] + class_score = scores[i] + else: + class_name = 'N/A' + display_str = '{}: {}%'.format( + class_name, + int(100*scores[i])) + else: + display_str = 'score: {}%'.format(int(100 * scores[i])) + box_to_display_str_map[box].append(display_str) + # box_to_ID_score[box].append(class_id) + data.append([class_id,class_score,box,]) + + # print(box_to_ID_score[box]) + if agnostic_mode: + box_to_color_map[box] = 'DarkOrange' + else: + box_to_color_map[box] = STANDARD_COLORS[ + classes[i] % len(STANDARD_COLORS)] + + for box, color in box_to_color_map.items(): + ymin, xmin, ymax, xmax = box + if instance_masks is not None: + draw_mask_on_image_array( + image, + box_to_instance_masks_map[box], + color=color + ) + + draw_bounding_box_on_image_array( + image, + ymin, + xmin, + ymax, + xmax, + color=color, + thickness=line_thickness, + display_str_list=box_to_display_str_map[box], + use_normalized_coordinates=use_normalized_coordinates) + if keypoints is not None: + draw_keypoints_on_image_array( + image, + box_to_keypoints_map[box], + color=color, + radius=line_thickness / 2, + use_normalized_coordinates=use_normalized_coordinates) + # print(box_to_display_str_map.items()) + # return (box_to_display_str_map.items()) + return (data) + diff --git a/src/object_detection/utils/visualization_utils_test.py b/train/src/object_detection/utils/visualization_utils_test.py similarity index 100% rename from src/object_detection/utils/visualization_utils_test.py rename to train/src/object_detection/utils/visualization_utils_test.py