Skip to content

Instantly share code, notes, and snippets.

View WuStangDan's full-sized avatar

Daniel Stang WuStangDan

View GitHub Profile
- boxes:
- {label: Green, occluded: false, x_max: 582.3417892052, x_min: 573.3726437481,
y_max: 276.6271175345, y_min: 256.3114627642}
- {label: Green, occluded: false, x_max: 517.6267821724, x_min: 510.0276868266,
y_max: 273.164089267, y_min: 256.4279864221}
path: ./rgb/train/2015-10-05-16-02-30_bag/720654.png
- boxes: []
path: ./rgb/train/2015-10-05-16-02-30_bag/720932.png
def create_tf_example(label_and_data_info):
# TODO START: Populate the following variables from your example.
height = None # Image height
width = None # Image width
filename = None # Filename of the image. Empty if image is not from file
encoded_image_data = None # Encoded image bytes
image_format = None # b'jpeg' or b'png'
xmins = [] # List of normalized left x coordinates in bounding box (1 per box)
xmaxs = [] # List of normalized right x coordinates in bounding box
import tensorflow as tf
from object_detection.utils import dataset_util
flags = tf.app.flags
flags.DEFINE_string('output_path', '', 'Path to output TFRecord')
FLAGS = flags.FLAGS
def create_tf_example(data_and_label_info):
...
...
class TrafficLightClassifier(object):
def __init__(self):
PATH_TO_MODEL = 'frozen_inference_graph.pb'
self.detection_graph = tf.Graph()
with self.detection_graph.as_default():
od_graph_def = tf.GraphDef()
# Works up to here.
with tf.gfile.GFile(PATH_TO_MODEL, 'rb') as fid:
serialized_graph = fid.read()
od_graph_def.ParseFromString(serialized_graph)
def get_classification(self, img):
# Bounding Box Detection.
with self.detection_graph.as_default():
# Expand dimension since the model expects image to have shape [1, None, None, 3].
img_expanded = np.expand_dims(img, axis=0)
(boxes, scores, classes, num) = self.sess.run(
[self.d_boxes, self.d_scores, self.d_classes, self.num_d],
feed_dict={self.image_tensor: img_expanded})
return boxes, scores, classes, num
@WuStangDan
WuStangDan / course_info.txt
Last active May 8, 2024 19:58
Course Info
Complete ROS Start Guide - Windows/Mac/Linux - C++/Python
Publish Date: 02/2021
Course Link:
Course VM Download: https://drive.google.com/file/d/1gLoLCgwuvMqX1yfecyg7vo3aumWJmqT9/view?usp=sharing
Virtual Box: https://www.virtualbox.org/
Autonomous Robots: Localization
Publish Date: 07/2020
Course Link: https://www.udemy.com/course/autonomous-robots-localization/
Package Requirements: python=3.7.4 numpy=1.16.4 matploblib=3.1.0
" must be first, changes behaviour of other settings
set nocompatible
" 256 colors
set t_Co=256
" sane text files
set fileformat=unix
set encoding=utf-8
@WuStangDan
WuStangDan / .vimrc
Created March 4, 2022 08:26
Vimrc with nice settings
" must be first, changes behaviour of other settings
set nocompatible
" 256 colors
set t_Co=256
" sane text files
set fileformat=unix
set encoding=utf-8