georgesung / ssd_tensorflow_traffic_sign_detection Goto Github PK
View Code? Open in Web Editor NEWImplementation of Single Shot MultiBox Detector in TensorFlow, to detect and classify traffic signs
License: MIT License
Implementation of Single Shot MultiBox Detector in TensorFlow, to detect and classify traffic signs
License: MIT License
When i running this command "python inference.py -m demo"
Restoring previously trained model at ./model.ckpt
Demo mode: Running inference on images in sample_images/
Running inference on sample_images/.DS_Store
Traceback (most recent call last):
File "inference.py", line 189, in
generate_output(input_files, mode)
File "inference.py", line 158, in generate_output
image_orig = np.asarray(Image.open('sample_images/' + image_file))
File "/usr/local/lib/python2.7/site-packages/PIL/Image.py", line 2519, in open
% (filename if filename else fp))
IOError: cannot identify image file 'sample_images/.DS_Store'
hi there
i got some error when run this command
python inference.py -m demo
error detail :
C:\Program Files\python\lib\site-packages\h5py\__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from
floatto
np.floatingis deprecated. In future, it will be treated as
np.float64 == np.dtype(float).type. from ._conv import register_converters as _register_converters 2018-05-24 13:44:47.911946: I d:\build\tensorflow\tensorflow-r1.7\tensorflow\core\platform\cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 Traceback (most recent call last): File "inference.py", line 189, in <module> generate_output(input_files, mode) File "inference.py", line 125, in generate_output model = SSDModel() File "D:\my media\my_project\open-cv_traffic-sine\PythonApplication2\PythonApplication2\model.py", line 178, in SSDModel model = AlexNet() File "D:\my media\my_project\open-cv_traffic-sine\PythonApplication2\PythonApplication2\model.py", line 159, in AlexNet final_pred_conf = tf.concat(1, preds_conf) File "C:\Program Files\python\lib\site-packages\tensorflow\python\ops\array_ops.py", line 1178, in concat dtype=dtypes.int32).get_shape().assert_is_compatible_with( File "C:\Program Files\python\lib\site-packages\tensorflow\python\framework\ops.py", line 950, in convert_to_tensor as_ref=False) File "C:\Program Files\python\lib\site-packages\tensorflow\python\framework\ops.py", line 1040, in internal_convert_to_tensor ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref) File "C:\Program Files\python\lib\site-packages\tensorflow\python\framework\constant_op.py", line 235, in _constant_tensor_conversion_function return constant(v, dtype=dtype, name=name) File "C:\Program Files\python\lib\site-packages\tensorflow\python\framework\constant_op.py", line 214, in constant value, dtype=dtype, shape=shape, verify_shape=verify_shape)) File "C:\Program Files\python\lib\site-packages\tensorflow\python\framework\tensor_util.py", line 433, in make_tensor_proto _AssertCompatible(values, dtype) File "C:\Program Files\python\lib\site-packages\tensorflow\python\framework\tensor_util.py", line 344, in _AssertCompatible (dtype.name, repr(mismatch), type(mismatch).__name__)) TypeError: Expected int32, got list containing Tensors of type '_Message' instead.
can anyone help me ?
what is it in the file "mergedAnnotations.csv" ?
hi,
I want to train your net model, use your given datasets.
But I did not found the mergedAnnotations.csv.
# For speed, put entire contents of mergedAnnotations.csv in memory
merged_annotations = []
with open('mergedAnnotations.csv', 'r') as f:
for line in f:
line = line[:-1] # strip trailing newline
merged_annotations.append(line)
thx
hi,
I use your AlexNet + SSD to detect the airplane and others. But The result not good, after I have trained 5000 epochs.
guiyang
My data_prep_400*260.p is around 2.1Gb, could someone tell me why? I have followed steps according to #29 .
Hello :)
I'm getting the following error while trying to run the demo by using the command :
python inference.py -m demo
ajmal@darkcow:~/Documents/ssd_tensorflow_traffic_sign_detection$ python inference.py -m demo
2017-06-28 14:52:35.472959: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2017-06-28 14:52:35.472990: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-06-28 14:52:35.472997: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2017-06-28 14:52:35.473003: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2017-06-28 14:52:35.473013: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
Traceback (most recent call last):
File "inference.py", line 190, in <module>
generate_output(input_files, mode)
File "inference.py", line 126, in generate_output
model = SSDModel()
File "/home/ajmal/Documents/ssd_tensorflow_traffic_sign_detection/model.py", line 178, in SSDModel
model = AlexNet()
File "/home/ajmal/Documents/ssd_tensorflow_traffic_sign_detection/model.py", line 159, in AlexNet
final_pred_conf = tf.concat(1, preds_conf)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 1043, in concat
dtype=dtypes.int32).get_shape(
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 676, in convert_to_tensor
as_ref=False)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 741, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/constant_op.py", line 113, in _constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/constant_op.py", line 102, in constant
tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape, verify_shape=verify_shape))
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/tensor_util.py", line 374, in make_tensor_proto
_AssertCompatible(values, dtype)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/tensor_util.py", line 302, in _AssertCompatible
(dtype.name, repr(mismatch), type(mismatch).__name__))
TypeError: Expected int32, got list containing Tensors of type '_Message' instead.
Please help me to sort this out.
Thankyou.
Thanks for your excellent codes.
But I can't find how you generate the default box, can you tell me please, thank you.
Hello,
I met "train loss : nan, validation loss :nan“ since more traffic sign classed been added by following steps.
In file creat_pickle.py
sign_name = fields[1]
if sign_name != 'pedestrainCrossing' and sign_name != 'signalAhead' and sign_name != 'stop':
continue
sign_class = sign_map[sign_name]
class_list.append(sign_class)
Traceback (most recent call last):
File "inference.py", line 189, in
generate_output(input_files, mode)
File "inference.py", line 130, in generate_output
saver.restore(sess, MODEL_SAVE_PATH)
File "E:\anaconda\envs\opencv\lib\site-packages\tensorflow\python\training\saver.py", line 1268, in restore
+ compat.as_text(save_path))
ValueError: The passed save_path is not a valid checkpoint: ./model.ckpt
how to modify this code? thanks
In your data_prepare.py file, why you want to transform the coords ?
# Calculate normalized box coordinates and update y_true_loc
abs_box_center = np.array([col + 0.5, row + 0.5]) # absolute coordinates of center of feature map cell
abs_gt_box_coords = gt_box_coords * scale # absolute ground truth box coordinates (in feature map grid)
norm_box_coords = abs_gt_box_coords - np.concatenate((abs_box_center, abs_box_center))
y_true_loc[y_true_idx*4 : y_true_idx*4 + 4] = norm_box_coords
I got this issue when run inference.py,can anyone help me? My python is python 2.7.5 and tensorflow is 1.1.0.
yjcai@inspur ssd_tensorflow_traffic_sign_detection]$ python inference.py -m demo
Traceback (most recent call last):
File "inference.py", line 6, in
from model import SSDModel
File "/export/userhome/yjcai/Documents/SSD/ssd_tensorflow_traffic_sign_detection/model.py", line 241
box = (*box_coords, cls, cls_prob)
^
SyntaxError: invalid syntax
first, thank you for your study.
i train data following your instruction.
i have 2,600 resized_images_400x260 using create_pickle.py.
before that, 6,618 annotations was acquired by using mergeAnnotationFiles.py and extractAnnotations.py.
then use data_prep.py and train.py
train loss and validation have high rate.
so, i can not detect any traffic-signs in demo.
i do not change any setting..
hope for your help.
I think you can remove this line in data_prep.py:
if match_counter > 0:
data_prep[image_file] = {'y_true_conf': y_true_conf, 'y_true_loc': y_true_loc}
Otherwise, the model assumes that all input are expected to have an object. Depending on the application this may not hold true. Train set should really reflect distribution in test set and that includes images without any object
what is your loss when ended training?
I rename the file 'allAnnotations.csv' to 'mergedAnnotations.csv' , and I run the 'create_pickle.py',but I also get the problem
Traceback (most recent call last):
File "create_pickle.py", line 42, in
image_files = os.listdir('annotations')
FileNotFoundError: [Errno 2] No such file or directory: 'annotations'
Where is 'annotations'? and it is right or not ,about my 'mergedAnnotations.csv' ?
I do not understand what you say in "Follow instructions in the LISA Traffic Sign Dataset to create 'mergedAnnotations.csv' such that only stop signs and pedestrian crossing signs are shown"
Traceback (most recent call last):
File "/home/tian/tensorflow/example/ssd_tensorflow_traffic_sign_detection-master/train.py", line 236, in
run_training()
File "/home/tian/tensorflow/example/ssd_tensorflow_traffic_sign_detection-master/train.py", line 123, in run_training
model = SSDModel()
File "/home/tian/tensorflow/example/ssd_tensorflow_traffic_sign_detection-master/model.py", line 178, in SSDModel
model = AlexNet()
File "/home/tian/tensorflow/example/ssd_tensorflow_traffic_sign_detection-master/model.py", line 159, in AlexNet
final_pred_conf = tf.concat(1, preds_conf)
File "/home/tian/.local/lib/python3.5/site-packages/tensorflow/python/ops/array_ops.py", line 1061, in concat
dtype=dtypes.int32).get_shape(
File "/home/tian/.local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 611, in convert_to_tensor
as_ref=False)
File "/home/tian/.local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 676, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "/home/tian/.local/lib/python3.5/site-packages/tensorflow/python/framework/constant_op.py", line 121, in _constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
File "/home/tian/.local/lib/python3.5/site-packages/tensorflow/python/framework/constant_op.py", line 102, in constant
tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape, verify_shape=verify_shape))
File "/home/tian/.local/lib/python3.5/site-packages/tensorflow/python/framework/tensor_util.py", line 376, in make_tensor_proto
_AssertCompatible(values, dtype)
File "/home/tian/.local/lib/python3.5/site-packages/tensorflow/python/framework/tensor_util.py", line 302, in _AssertCompatible
(dtype.name, repr(mismatch), type(mismatch).name))
TypeError: Expected int32, got list containing Tensors of type '_Message' instead.
It seems that something wrong in here: final_pred_conf = tf.concat(1, preds_conf)
I am eager for your help, please help me ...
I followed your instruction and trained the model again, but when i run it as a demo, it always shows such an error.
File "/home/hg/anaconda3b/python3.5/site-packages/tensorflow/python/framework/tensor_util.py", line 367, in make_tensor_proto
_AssertCompatible(values, dtype)
File "/home/hg/anaconda3b/python3.5/site-packages/tensorflow/python/framework/tensor_util.py", line 302, in _AssertCompatible
(dtype.name, repr(mismatch), type(mismatch).name))
TypeError: Expected int32, got list containing Tensors of type '_Message' instead.
Hello! when i run python inference.py -m demo
i see error
WARNING:tensorflow:From /home/user/ssd_tensorflow_traffic_sign_detection-master/model.py:79: get_regularization_losses (from tensorflow.contrib.losses.python.losses.loss_ops) is deprecated and will be removed after 2016-12-30.
Instructions for updating:
Use tf.losses.get_regularization_losses instead.
Restoring previously trained model at ./model.ckpt
Demo mode: Running inference on images in sample_images/
Running inference on sample_images/stop_1323896809.avi_image12.png
Inference took 38399.9 ms (0.03 fps)
Traceback (most recent call last):
File "inference.py", line 189, in <module>
generate_output(input_files, mode)
File "inference.py", line 159, in generate_output
image = run_inference(image_orig, model, sess, mode, sign_map)
File "inference.py", line 74, in run_inference
boxes = nms(y_pred_conf, y_pred_loc, prob)
File "/home/user/ssd_tensorflow_traffic_sign_detection-master/model.py", line 248, in nms
iou = calc_iou(box[:4], other_box[:4])
File "/home/user/ssd_tensorflow_traffic_sign_detection-master/data_prep.py", line 29, in calc_iou
iou = intersection / union
ZeroDivisionError: division by zero
I trained the whole LISA dataset, but when the train code was running. I found that the Train loss and Validation loss were up to 2600! Does anybody know what the problem is ??
这一步怎么做
The original SSD paper point out that the scales should be different at different feature maps, but I find your code assign the scale same size in different feture map size. And the hard example methods isn't aplied. So I am wondering whether the effect is improving if appy these two tricks?
please help me
/ssd$ python inference.py
Traceback (most recent call last):
File "inference.py", line 10, in
from sklearn.model_selection import train_test_split
ImportError: No module named 'sklearn.model_selection'
why has a error?
Now for your model, only detect two traffic sign class, if I want to detect the 47 traffic sign class (the total class in the LISA dataset) in this model, Can the AlexNet still use into this situation?
how can I fine-tune this pre-trained network?
I use below command, and find no such file mergedAnnotations.csv, any suggestions?
I download LISA data ,but
$ python create_pickle.py
Traceback (most recent call last):
File "create_pickle.py", line 36, in
with open('mergedAnnotations.csv', 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'mergedAnnotations.csv'
Thanks!
Did you initialize the base classifier layers with pre-trained values when training the full ssd model? I have a custom dataset, but my model will not converge to anything. I was wondering if I have to train my base classifier first with my custom dataset before training the ssd model.
Thank you for your code. Great Work.
I got the annotations folder after run the two codes for data processing : extractAnnotations.py and mergeAnnotationFiles.py. The annotation folder contains of 2325 crop images of stop and pedestrian detection sign.
Now the problem is occurred when I run pickle file (create_pickle.py) for pickling the data of resize image. I got a pickle file name as "data_raw_400x260.p" but the size is 6 byte. If this problem is not solved then I can't move to next stage. Please help me.
tensorflow.python.framework.errors_impl.InvalidArgumentError: Shapes must be equal rank, but are 2 and 1
From merging shape 0 with other shapes. for 'packed' (op: 'Pack') with input shapes: [?,23436], [3].
please help me
ValueError: Shapes must be equal rank, but are 2 and 1
From merging shape 0 with other shapes. for 'packed' (op: 'Pack') with input shapes: [?,23436], [3].
I should how charge the error?
Can anybody please assist me how to train and add more Traffic sign classes along with Pedestrian walking and Stop. It's Urgent please help me...
I'm not sure if the issue is about tensorflow version.I was using tensorflow v1.12 and error occured at the function : final_pred_conf = tf.concat(1, preds_conf) final_pred_loc = tf.concat(1, preds_loc) at line 159 in file model.py. I have no idea how to solve it, I would appreciate it if someone can give a hand~
When I trained the model, I got nan for train and validation loss! with tensorflow 1.4, python3.5
box_coords = np.array([int(x) for x in
。。。。。
ulc_x, ulc_y, lrc_x, lrc_y = box_coords
ValueError: not enough values to unpack (expected 4, got 0)
Thank you for your work.
For several days I'm trying to understand and implement your work. I read the paper and I get confused. Are you using the convolution type scanning on the resized image or on the original image. When I looked at the paper it seems to be the original images but in the code I think you are using the resized images in data_prep.py. The problem come through when the calc_iou() tries to find the matched, but the rescaled box coordinates of the ground truth aren't in between 0 and 1. Can you clarify this issue a little?
Thanks
hi @georgesung i ran python inference.py -m demo i get this error on both windows and ubuntu
value, dtype=dtype, shape=shape, verify_shape=verify_shape))
File "C:\Python35\lib\site-packages\tensorflow\python\framework\tensor_util.py", line 413, in make_tensor_proto
_AssertCompatible(values, dtype)
File "C:\Python35\lib\site-packages\tensorflow\python\framework\tensor_util.py", line 328, in _AssertCompatible
(dtype.name, repr(mismatch), type(mismatch).name)
TypeError: Expected int32, got list containing Tensors of type '_Message' instead.
I have tensorflow v14 the latest version installed in the system can you pls suggest me where should i make the necessary changes for the file to run
Traceback (most recent call last):
File "inference.py", line 189, in
generate_output(input_files, mode)
File "inference.py", line 125, in generate_output
model = SSDModel()
File "/Users/PEE/tensorflow/models/object_detection/ssd_tensorflow_traffic_sign_detection/model.py", line 178, in SSDModel
model = AlexNet()
File "/Users/PEE/tensorflow/models/object_detection/ssd_tensorflow_traffic_sign_detection/model.py", line 159, in AlexNet
final_pred_conf = tf.concat(1, preds_conf)
File "/Users/PEE/tensorflow/lib/python2.7/site-packages/tensorflow/python/ops/array_ops.py", line 1043, in concat
dtype=dtypes.int32).get_shape(
File "/Users/PEE/tensorflow/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 676, in convert_to_tensor
as_ref=False)
File "/Users/PEE/tensorflow/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 741, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "/Users/PEE/tensorflow/lib/python2.7/site-packages/tensorflow/python/framework/constant_op.py", line 113, in _constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
File "/Users/PEE/tensorflow/lib/python2.7/site-packages/tensorflow/python/framework/constant_op.py", line 102, in constant
tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape, verify_shape=verify_shape))
File "/Users/PEE/tensorflow/lib/python2.7/site-packages/tensorflow/python/framework/tensor_util.py", line 374, in make_tensor_proto
_AssertCompatible(values, dtype)
File "/Users/PEE/tensorflow/lib/python2.7/site-packages/tensorflow/python/framework/tensor_util.py", line 302, in _AssertCompatible
(dtype.name, repr(mismatch), type(mismatch).name))
TypeError: Expected int32, got list containing Tensors of type '_Message' instead.
please help me
Traceback (most recent call last):
File "D:/traffic_sign/ssd/ssd/inference.py", line 185, in
input_files = glob.glob(input_dir + '/.')
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
I think the error that is input_dir,but
parser = OptionParser()
parser.add_option('-i', '--input_dir', dest='input_dir',type='string',
help='Directory of input videos/images (ignored for "demo" mode). Will run inference on all videos/images in that dir')
parser.add_option('-m', '--mode', dest='mode', default='image',
help='Operating mode, could be "image", "video", or "demo"; "demo" mode displays annotated images from sample_images/')
# Get and parse command line options
options, args = parser.parse_args(args)
put_dir = options.input_dir
what are --input_dir input file?the help prompt should not be the path(image or video),but it's wrong for me to enter the path of sample_images.
Please help me if I am wrong.
Why use Alexnet instead of VGG?
In the original paper, the sum of confidence loss and localization loss is divided by "N", where N is the number of matched default boxes. I fail to see where that division is implemented in the code. Without that my loss is very high...
I can not find 'signnames.csv' in your git.
Is that in 'LISA Traffic Sign Dataset' ?
First, I git clone https://github.com/georgesung/ssd_tensorflow_traffic_sign_detection.git
Then,I cd ssd_tensorflow_traffic_sign_detection.
And I run python inference.py -m demo, but error:
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcublas.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcudnn.so.5 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcufft.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcurand.so.8.0 locally
Traceback (most recent call last):
File "inference.py", line 6, in
from model import SSDModel
File "/home/ubuntu/ssd_tensorflow_traffic_sign_detection/model.py", line 241
box = (*box_coords, cls, cls_prob)
^
SyntaxError: invalid syntax
Great work! Btw, I want to train the model but stuck in this step:
"Follow instructions in the LISA Traffic Sign Dataset to create 'mergedAnnotations.csv' such that only stop signs and pedestrian crossing signs are shown"
How do I filter all except stop sign and pedestrian cross? I read the mergeAnnotationFiles.py but no clue. Please help me.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.