A keras version of real-time object detection network: mobilenet_v2_ssdlite
the pretrained weights file in the 'pretrained_weights' folder
the model structure in the 'model' folder
the train and inference process in the 'experiments' folder
A keras version of real-time object detection network : mobilenet_v2_ssdlite
@markshih91, I want to training the model on my dataset that have two classess, how to sub-sample the weight tensors of all the classification layers?
I have trained the model on a custom dataset
When I do inferencing there are multiple bbox for the same object and even after changing IOU value from 0.9 to 0.1.
I am not sure why IOU is not taking any effect on inferencing
Did anybody face a similar problem?
Thank you
Hello, @markshih91 , thanks for your repo first !
I cloneed this repo, and try to adapt it to TF 2.1 -gpu by modifying a few API.
After i modified all the APIs, and run inference.py, pycharm shows below error:
Could you give me some suggestion to fix it ? thanks!
哈喽,博主你好,首先感谢你上传了这个仓库
我下载了这个仓库,并试图把它改编成适应TF2.1-gpu,这主要就是改改API
当我把这些API都改完之后再运行inference.py,pycharm报出了上图的错误
你能给一些建议来解决它吗?谢谢!
tensorflow 2.4.0
keras 2.4.3
KerasTensor(type_spec=TensorSpec(shape=(None, 2268, 81), dtype=tf.float32, name=None), name='ssd_mbox_conf_softmax/truediv:0', description="created by layer 'ssd_mbox_conf_softmax'")
KerasTensor(type_spec=TensorSpec(shape=(None, 2268, 4), dtype=tf.float32, name=None), name='ssd_box/concat:0', description="created by layer 'ssd_box'")
KerasTensor(type_spec=TensorSpec(shape=(None, 4000, 8), dtype=tf.float32, name=None), name='ssd_priorbox/concat:0', description="created by layer 'ssd_priorbox'")
Traceback (most recent call last):
File "experiments/inference.py", line 42, in
model = mobilenet_v2_ssd(image_size, n_classes, mode, l2_regularization, min_scale, max_scale, scales,
File "/Users/xx/Work/AI/TF/code/mobilenet_v2_ssdlite_keras/models/keras_mobilenet_v2_ssdlite.py", line 386, in mobilenet_v2_ssd
predictions = Concatenate(axis=0, name='ssd_predictions')([cls, box, priorbox])
File "/Users/xx/.conda/envs/tensorflow/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer.py", line 951, in call
return self._functional_construction_call(inputs, args, kwargs,
File "/Users/xx/.conda/envs/tensorflow/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer.py", line 1090, in _functional_construction_call
outputs = self._keras_tensor_symbolic_call(
File "/Users/xx/.conda/envs/tensorflow/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer.py", line 822, in _keras_tensor_symbolic_call
return self._infer_output_signature(inputs, args, kwargs, input_masks)
File "/Users/xx/.conda/envs/tensorflow/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer.py", line 862, in _infer_output_signature
self._maybe_build(inputs)
File "/Users/xx/.conda/envs/tensorflow/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer.py", line 2710, in _maybe_build
self.build(input_shapes) # pylint:disable=not-callable
File "/Users/xx/.conda/envs/tensorflow/lib/python3.8/site-packages/tensorflow/python/keras/utils/tf_utils.py", line 272, in wrapper
output_shape = fn(instance, input_shape)
File "/Users/xx/.conda/envs/tensorflow/lib/python3.8/site-packages/tensorflow/python/keras/layers/merge.py", line 519, in build
raise ValueError(err_msg)
ValueError: A Concatenate
layer requires inputs with matching shapes except for the concat axis. Got inputs shapes: [(None, 2268, 81), (None, 2268, 4), (None, 4000, 8)]
Hi @markshih91 ,
Could you please provide a requirement.txt or tensorflow , keras version you have used for this project?
I tried
tensorflow :2.3.1 | keras : 2.2.0
tensorflow :1.4 | keras : 2.0.8
Thanks
who can tell me,make the project work,Version number required keras and tensorflow.
请问,让代码跑起来,需要的tensorflow 和keras的版本号各是多少?我这边总报错。
谢谢!
When I use my own dataset for training, I got this error message at model.fit_generator.
Tensor conversion requested dtype float32_ref for Tensor with dtype float32: 'Tensor("Adam/bbn_stage1_block1_conv/kernel/m/Initializer/zeros:0", shape=(3, 3, 3, 32), dtype=float32)'
Would you meet this error ever?
Hi @markshih91
I trained your model on a toy dataset where the task was just to predict the edges of randomly generated black rectangles on a white background, something which should be a simple task.
The loss and val-loss seem to be low here but the predictions seem to be very much off (Negative values in the predictions seem to be the norm, which I've truncated). Is this because of an error in the decoding layer?
This is a snapshot of the loss.
The predictions (seen in red) -
My model is configured to train using the following configuration
aspect_ratios_per_layer = [[1.0, 2.0, 0.5],
[1.0, 2.0, 0.5, 3.0, 1.0 / 3.0],
[1.0, 2.0, 0.5, 3.0, 1.0 / 3.0],
[1.0, 2.0, 0.5, 3.0, 1.0 / 3.0],
[1.0, 2.0, 0.5],
[1.0, 2.0, 0.5]]
predictor_sizes = [model.get_layer('ssd_cls1conv2_bn').output_shape[1:3],
model.get_layer('ssd_cls2conv2_bn').output_shape[1:3],
model.get_layer('ssd_cls3conv2_bn').output_shape[1:3],
model.get_layer('ssd_cls4conv2_bn').output_shape[1:3],
model.get_layer('ssd_cls5conv2_bn').output_shape[1:3],
model.get_layer('ssd_cls6conv2_bn').output_shape[1:3]]
image_size=(416,416,3)
n_classes=1
min_scale=0.3
max_scale=0.9
normalize_coords=False
subtract_mean=None
divide_by_stddev=None
swap_channels=None #[2,1,0],
confidence_thresh=0.01
iou_threshold=0.45
top_k=200
scales = None
aspect_ratios_global = None
return_predictor_sizes = False
two_boxes_for_ar1=True
steps=None
offsets=None
clip_boxes=True
variances=[0.1, 0.1, 0.2, 0.2]
matching_type='multi'
pos_iou_threshold=0.45
neg_iou_limit=0.3
model = mobilenet_v2_ssd(
image_size=image_size,
n_classes=n_classes,
min_scale=min_scale,
max_scale=max_scale,
coords='corners',
mode='training',
clip_boxes=clip_boxes,
normalize_coords=normalize_coords,
subtract_mean=subtract_mean,
divide_by_stddev=divide_by_stddev,
swap_channels=swap_channels,
confidence_thresh=confidence_thresh,
iou_threshold=iou_threshold,
top_k=top_k
)
And it predicts using similar configurations, except with top_k=1, coords='centroids', mode='inference'
I've trained with a large-ish dataset composed of around 3000 images for the training set and 500 images on the validation set. The predictions you see are on the training set itself which I expected to be better due to the reportedly low loss. The rest of the training config is similar to that of the example posted. The ground truth is of the format image-name, class, xmin, ymin, xmax, ymax
Thanks in advance!
Hi @markshih91
I have used your model to train COCO dataset. I just found 1 error in your script *ssdlite_praph.py one of the link definition were missing. Unfortunately it does quickly stabilize around 5000 steps. I also tested with scales modified in train.py as suggested by @pierluigiferrari but no real difference. Did you trained with the version you have posted? Can you share your training experience here? Thx
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.