Code Monkey home page Code Monkey logo

ssd_keras's Introduction

Single Shot MultiBox Detector Keras version.

SSD是一种Object Detection方法。本文是基于论文SSD: Single Shot MultiBox Detector,实现的keras版本。

该文章在既保证速度,又要保证精度的情况下,提出了SSD物体检测模型,与现在流行的检测模型一样,将检测过程整个成一个single deep neural network。便于训练与优化,同时提高检测速度。 SSD将输出一系列离散化(discretization)的bounding boxes,这些bounding boxes是在不同层次(layers)上的feature maps上生成的,并且有着不同的aspect ratio。

模型效果

  • 模型对载具的检测

  • 模型对动物的检测

  • 模型的视频检测


如何使用

所需依赖

cv2==3.3.0
keras==2.2.0
matplotlib==2.1.0
tensorflow==1.3.0
numpy==1.13.3

如果想跑通视频模块,则需额外pip install scikit-video

具体操作

git clone [email protected]:kuhung/SSD_keras.git
cd SSD_keras
  • Download model weight weights_SSD300.hdf5here
cp weights_SSD300.hdf5 into SSD_keras
  • 对于图片的检测

参考SSD.ipynb

  • 若要剪切图片为下一步处理做准备

参考SSD_crop.py

  • 检测视频
cd video_utils
python videotest_example.py hy.mp4

参考资料

SSD: Single Shot MultiBox Detector

论文阅读:SSD: Single Shot MultiBox Detector

rykov8/ssd_keras

ssd_keras's People

Contributors

kuhung avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ssd_keras's Issues

训练模型的时候出现问题

当我一步一步运行SSD_training.ipynb文件训练模型的时候,当运行到:
model = SSD300(input_shape, num_classes=NUM_CLASSES)这一步的时候,总是会出现:
File "D:\anaconda\envs\kerasSSD\lib\site-packages\tensorflow\python\framework\common_shapes.py", line 659, in _call_cpp_shape_fn_impl
raise ValueError(err.message)
ValueError: Dimensions must be equal, but are 512 and 38 for 'conv4_3_norm_1/mul' (op: 'Mul') with input shapes: [?,38,38,512], [38].这样的错误
原先我以为是keras、tensorflow版本的问题,后来版本改到您要求的版本后还是会出现
实在不知道怎么解决了,可否指导一下,谢谢!

无法编译通过检测交通标示的实验

错误提示:ValueError: Dimensions must be equal, but are 512 and 38 for 'conv4_3_norm/mul' (op: 'Mul') with input shapes: [?,38,38,512], [38].

错误代码:net['conv4_3_norm'] = Normalize(20, name='conv4_3_norm')(net['conv4_3'])

希望能帮忙看一下是哪里出了问题?

你好 我无法生成的train.pk

C:\Users\wangkai\Desktop\kk344>python get_data_from_XML.py
Traceback (most recent call last):
File "get_data_from_XML.py", line 68, in
data = XML_preprocessor(sys.argv[0]).data
File "get_data_from_XML.py", line 13, in init
self._preprocess_XML()
File "get_data_from_XML.py", line 16, in _preprocess_XML
filenames = os.listdir(self.path_prefix)
NotADirectoryError: [WinError 267] 目录名称无效。: 'get_data_from_XML.py'

运行时报错:RuntimeError: module compiled against API version 0xc but this version of numpy is 0xb

你好,在运行你的代码的时候,报了这么一个错误:RuntimeError: module compiled against API version 0xc but this version of numpy is 0xb,网上找了一下原因大概都是说numpy的版本有问题之类的,但是我的环境配置都是跟您readme里面的是一样的,不同的是,由于我是在Windows下跑这个代码的,而tensorflow在windows下只能支持python3,所以我的python版本是3.7的。

scikit-video

@kuhung 您好!
请问scikit-video的版本是多少呢,我安装最新的1.1.11出现很多奇怪的问题。谢谢!

gpu 利用率不高

你好,我在训练数据时发现GPU的利用率不超过40%,请问能在哪里设置让他的可利用率高一点,以加快训练吗? 十分感谢

TypeError: 'module' object is not callable

环境版本与要求一致,运行python videotest_example.py hy.mp4,提示:
Using TensorFlow backend.
../ssd.py:40: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(64, (3, 3), activation="relu", name="conv1_1", padding="same")
name='conv1_1')(net['input'])
../ssd.py:44: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(64, (3, 3), activation="relu", name="conv1_2", padding="same")
name='conv1_2')(net['conv1_1'])
../ssd.py:46: UserWarning: Update your MaxPooling2D call to the Keras 2 API: MaxPooling2D((2, 2), strides=(2, 2), name="pool1", padding="same")
name='pool1')(net['conv1_2'])
../ssd.py:51: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(128, (3, 3), activation="relu", name="conv2_1", padding="same")
name='conv2_1')(net['pool1'])
../ssd.py:55: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(128, (3, 3), activation="relu", name="conv2_2", padding="same")
name='conv2_2')(net['conv2_1'])
../ssd.py:57: UserWarning: Update your MaxPooling2D call to the Keras 2 API: MaxPooling2D((2, 2), strides=(2, 2), name="pool2", padding="same")
name='pool2')(net['conv2_2'])
../ssd.py:62: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(256, (3, 3), activation="relu", name="conv3_1", padding="same")
name='conv3_1')(net['pool2'])
../ssd.py:66: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(256, (3, 3), activation="relu", name="conv3_2", padding="same")
name='conv3_2')(net['conv3_1'])
../ssd.py:70: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(256, (3, 3), activation="relu", name="conv3_3", padding="same")
name='conv3_3')(net['conv3_2'])
../ssd.py:72: UserWarning: Update your MaxPooling2D call to the Keras 2 API: MaxPooling2D((2, 2), strides=(2, 2), name="pool3", padding="same")
name='pool3')(net['conv3_3'])
../ssd.py:77: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(512, (3, 3), activation="relu", name="conv4_1", padding="same")
name='conv4_1')(net['pool3'])
../ssd.py:81: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(512, (3, 3), activation="relu", name="conv4_2", padding="same")
name='conv4_2')(net['conv4_1'])
../ssd.py:85: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(512, (3, 3), activation="relu", name="conv4_3", padding="same")
name='conv4_3')(net['conv4_2'])
../ssd.py:87: UserWarning: Update your MaxPooling2D call to the Keras 2 API: MaxPooling2D((2, 2), strides=(2, 2), name="pool4", padding="same")
name='pool4')(net['conv4_3'])
../ssd.py:92: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(512, (3, 3), activation="relu", name="conv5_1", padding="same")
name='conv5_1')(net['pool4'])
../ssd.py:96: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(512, (3, 3), activation="relu", name="conv5_2", padding="same")
name='conv5_2')(net['conv5_1'])
../ssd.py:100: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(512, (3, 3), activation="relu", name="conv5_3", padding="same")
name='conv5_3')(net['conv5_2'])
../ssd.py:102: UserWarning: Update your MaxPooling2D call to the Keras 2 API: MaxPooling2D((3, 3), strides=(1, 1), name="pool5", padding="same")
name='pool5')(net['conv5_3'])
/home/zwc/anaconda3/envs/ssd-video/lib/python3.6/site-packages/keras/legacy/layers.py:301: UserWarning: The AtrousConvolution2D layer has been deprecated. Use instead the Conv2D layer with the dilation_rate argument.
warnings.warn('The AtrousConvolution2D layer '
/home/zwc/anaconda3/envs/ssd-video/lib/python3.6/site-packages/keras/legacy/layers.py:305: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(1024, (3, 3), activation="relu", name="fc6", dilation_rate=(6, 6), padding="same")
return Conv2D(*args, **kwargs)
../ssd.py:110: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(1024, (1, 1), activation="relu", name="fc7", padding="same")
border_mode='same', name='fc7')(net['fc6'])
../ssd.py:115: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(256, (1, 1), activation="relu", name="conv6_1", padding="same")
name='conv6_1')(net['fc7'])
../ssd.py:118: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(512, (3, 3), activation="relu", name="conv6_2", strides=(2, 2), padding="same")
name='conv6_2')(net['conv6_1'])
../ssd.py:122: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(128, (1, 1), activation="relu", name="conv7_1", padding="same")
name='conv7_1')(net['conv6_2'])
../ssd.py:126: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(256, (3, 3), activation="relu", name="conv7_2", strides=(2, 2), padding="valid")
name='conv7_2')(net['conv7_2'])
../ssd.py:130: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(128, (1, 1), activation="relu", name="conv8_1", padding="same")
name='conv8_1')(net['conv7_2'])
../ssd.py:133: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(256, (3, 3), activation="relu", name="conv8_2", strides=(2, 2), padding="same")
name='conv8_2')(net['conv8_1'])
../ssd.py:140: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(12, (3, 3), name="conv4_3_norm_mbox_loc", padding="same")
name='conv4_3_norm_mbox_loc')(net['conv4_3_norm'])
../ssd.py:148: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(63, (3, 3), name="conv4_3_norm_mbox_conf", padding="same")
name=name)(net['conv4_3_norm'])
../ssd.py:160: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(24, (3, 3), name="fc7_mbox_loc", padding="same")
name='fc7_mbox_loc')(net['fc7'])
../ssd.py:168: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(126, (3, 3), name="fc7_mbox_conf", padding="same")
name=name)(net['fc7'])
../ssd.py:178: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(24, (3, 3), name="conv6_2_mbox_loc", padding="same")
name='conv6_2_mbox_loc')(net['conv6_2'])
../ssd.py:186: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(126, (3, 3), name="conv6_2_mbox_conf", padding="same")
name=name)(net['conv6_2'])
../ssd.py:197: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(24, (3, 3), name="conv7_2_mbox_loc", padding="same")
name='conv7_2_mbox_loc')(net['conv7_2'])
../ssd.py:205: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(126, (3, 3), name="conv7_2_mbox_conf", padding="same")
name=name)(net['conv7_2'])
../ssd.py:216: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(24, (3, 3), name="conv8_2_mbox_loc", padding="same")
name='conv8_2_mbox_loc')(net['conv8_2'])
../ssd.py:224: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(126, (3, 3), name="conv8_2_mbox_conf", padding="same")
name=name)(net['conv8_2'])
Traceback (most recent call last):
File "videotest_example.py", line 16, in
model = SSD(input_shape, num_classes=NUM_CLASSES)
File "../ssd.py", line 258, in SSD300
mode='concat', concat_axis=1, name='mbox_loc')
TypeError: 'module' object is not callable
上网查了之后,将ssd.py中修改如下:
net['mbox_loc'] = concatenate([net['conv4_3_norm_mbox_loc_flat'],
net['fc7_mbox_loc_flat'],
net['conv6_2_mbox_loc_flat'],
net['conv7_2_mbox_loc_flat'],
net['conv8_2_mbox_loc_flat'],
net['pool6_mbox_loc_flat']],
axis=1, name='mbox_loc')
net['mbox_conf'] = concatenate([net['conv4_3_norm_mbox_conf_flat'],
net['fc7_mbox_conf_flat'],
net['conv6_2_mbox_conf_flat'],
net['conv7_2_mbox_conf_flat'],
net['conv8_2_mbox_conf_flat'],
net['pool6_mbox_conf_flat']],
axis=1, name='mbox_conf')
net['mbox_priorbox'] = concatenate([net['conv4_3_norm_mbox_priorbox'],
net['fc7_mbox_priorbox'],
net['conv6_2_mbox_priorbox'],
net['conv7_2_mbox_priorbox'],
net['conv8_2_mbox_priorbox'],
net['pool6_mbox_priorbox']],
axis=1,
name='mbox_priorbox')
之后报错如下:
Using TensorFlow backend.
../ssd.py:41: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(64, (3, 3), activation="relu", name="conv1_1", padding="same")
name='conv1_1')(net['input'])
../ssd.py:45: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(64, (3, 3), activation="relu", name="conv1_2", padding="same")
name='conv1_2')(net['conv1_1'])
../ssd.py:47: UserWarning: Update your MaxPooling2D call to the Keras 2 API: MaxPooling2D((2, 2), strides=(2, 2), name="pool1", padding="same")
name='pool1')(net['conv1_2'])
../ssd.py:52: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(128, (3, 3), activation="relu", name="conv2_1", padding="same")
name='conv2_1')(net['pool1'])
../ssd.py:56: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(128, (3, 3), activation="relu", name="conv2_2", padding="same")
name='conv2_2')(net['conv2_1'])
../ssd.py:58: UserWarning: Update your MaxPooling2D call to the Keras 2 API: MaxPooling2D((2, 2), strides=(2, 2), name="pool2", padding="same")
name='pool2')(net['conv2_2'])
../ssd.py:63: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(256, (3, 3), activation="relu", name="conv3_1", padding="same")
name='conv3_1')(net['pool2'])
../ssd.py:67: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(256, (3, 3), activation="relu", name="conv3_2", padding="same")
name='conv3_2')(net['conv3_1'])
../ssd.py:71: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(256, (3, 3), activation="relu", name="conv3_3", padding="same")
name='conv3_3')(net['conv3_2'])
../ssd.py:73: UserWarning: Update your MaxPooling2D call to the Keras 2 API: MaxPooling2D((2, 2), strides=(2, 2), name="pool3", padding="same")
name='pool3')(net['conv3_3'])
../ssd.py:78: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(512, (3, 3), activation="relu", name="conv4_1", padding="same")
name='conv4_1')(net['pool3'])
../ssd.py:82: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(512, (3, 3), activation="relu", name="conv4_2", padding="same")
name='conv4_2')(net['conv4_1'])
../ssd.py:86: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(512, (3, 3), activation="relu", name="conv4_3", padding="same")
name='conv4_3')(net['conv4_2'])
../ssd.py:88: UserWarning: Update your MaxPooling2D call to the Keras 2 API: MaxPooling2D((2, 2), strides=(2, 2), name="pool4", padding="same")
name='pool4')(net['conv4_3'])
../ssd.py:93: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(512, (3, 3), activation="relu", name="conv5_1", padding="same")
name='conv5_1')(net['pool4'])
../ssd.py:97: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(512, (3, 3), activation="relu", name="conv5_2", padding="same")
name='conv5_2')(net['conv5_1'])
../ssd.py:101: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(512, (3, 3), activation="relu", name="conv5_3", padding="same")
name='conv5_3')(net['conv5_2'])
../ssd.py:103: UserWarning: Update your MaxPooling2D call to the Keras 2 API: MaxPooling2D((3, 3), strides=(1, 1), name="pool5", padding="same")
name='pool5')(net['conv5_3'])
/home/zwc/anaconda3/envs/ssd-video/lib/python3.6/site-packages/keras/legacy/layers.py:301: UserWarning: The AtrousConvolution2D layer has been deprecated. Use instead the Conv2D layer with the dilation_rate argument.
warnings.warn('The AtrousConvolution2D layer '
/home/zwc/anaconda3/envs/ssd-video/lib/python3.6/site-packages/keras/legacy/layers.py:305: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(1024, (3, 3), activation="relu", name="fc6", dilation_rate=(6, 6), padding="same")
return Conv2D(*args, **kwargs)
../ssd.py:111: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(1024, (1, 1), activation="relu", name="fc7", padding="same")
border_mode='same', name='fc7')(net['fc6'])
../ssd.py:116: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(256, (1, 1), activation="relu", name="conv6_1", padding="same")
name='conv6_1')(net['fc7'])
../ssd.py:119: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(512, (3, 3), activation="relu", name="conv6_2", strides=(2, 2), padding="same")
name='conv6_2')(net['conv6_1'])
../ssd.py:123: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(128, (1, 1), activation="relu", name="conv7_1", padding="same")
name='conv7_1')(net['conv6_2'])
../ssd.py:127: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(256, (3, 3), activation="relu", name="conv7_2", strides=(2, 2), padding="valid")
name='conv7_2')(net['conv7_2'])
../ssd.py:131: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(128, (1, 1), activation="relu", name="conv8_1", padding="same")
name='conv8_1')(net['conv7_2'])
../ssd.py:134: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(256, (3, 3), activation="relu", name="conv8_2", strides=(2, 2), padding="same")
name='conv8_2')(net['conv8_1'])
../ssd.py:141: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(12, (3, 3), name="conv4_3_norm_mbox_loc", padding="same")
name='conv4_3_norm_mbox_loc')(net['conv4_3_norm'])
../ssd.py:149: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(63, (3, 3), name="conv4_3_norm_mbox_conf", padding="same")
name=name)(net['conv4_3_norm'])
../ssd.py:161: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(24, (3, 3), name="fc7_mbox_loc", padding="same")
name='fc7_mbox_loc')(net['fc7'])
../ssd.py:169: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(126, (3, 3), name="fc7_mbox_conf", padding="same")
name=name)(net['fc7'])
../ssd.py:179: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(24, (3, 3), name="conv6_2_mbox_loc", padding="same")
name='conv6_2_mbox_loc')(net['conv6_2'])
../ssd.py:187: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(126, (3, 3), name="conv6_2_mbox_conf", padding="same")
name=name)(net['conv6_2'])
../ssd.py:198: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(24, (3, 3), name="conv7_2_mbox_loc", padding="same")
name='conv7_2_mbox_loc')(net['conv7_2'])
../ssd.py:206: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(126, (3, 3), name="conv7_2_mbox_conf", padding="same")
name=name)(net['conv7_2'])
../ssd.py:217: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(24, (3, 3), name="conv8_2_mbox_loc", padding="same")
name='conv8_2_mbox_loc')(net['conv8_2'])
../ssd.py:225: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(126, (3, 3), name="conv8_2_mbox_conf", padding="same")
name=name)(net['conv8_2'])
Traceback (most recent call last):
File "videotest_example.py", line 16, in
model = SSD(input_shape, num_classes=NUM_CLASSES)
File "../ssd.py", line 274, in SSD300
name='mbox_priorbox')
File "/home/zwc/anaconda3/envs/ssd-video/lib/python3.6/site-packages/keras/layers/merge.py", line 641, in concatenate
return Concatenate(axis=axis, **kwargs)(inputs)
File "/home/zwc/anaconda3/envs/ssd-video/lib/python3.6/site-packages/keras/engine/base_layer.py", line 434, in call
self.build(input_shapes)
File "/home/zwc/anaconda3/envs/ssd-video/lib/python3.6/site-packages/keras/layers/merge.py", line 354, in build
'Got inputs shapes: %s' % (input_shape))
ValueError: A Concatenate layer requires inputs with matching shapes except for the concat axis. Got inputs shapes: [(None, 38, 38, 512), (None, 19, 19, 1024), (None, 10, 10, 512), (None, 5, 5, 256), (None, 3, 3, 256), (None, 1, 1, 256)]

多样本训练问题

您好!
我现在已经可以按照交通标志识别的步骤可以训练出自己的模型了(教程中的三种)
我想要增大训练样本和种类,比如进行四种交通标志的识别,请问
1、预训练权重weights_SSD300.hdf5是否可以继续使用?
2、最后预测的结果图片上预测种类为何显示为“1”“2”“3”的数字?如何修改为种类名称,比如“packing”之类的名称。
感谢回复

训练时候出现错误

ValueError Traceback (most recent call last)
in
5 validation_data=gen.generate(False),
6 validation_steps=num_val,
----> 7 nb_worker=0)

/opt/conda/lib/python3.6/site-packages/keras/legacy/interfaces.py in wrapper(*args, **kwargs)
89 warnings.warn('Update your ' + object_name + ' call to the ' +
90 'Keras 2 API: ' + signature, stacklevel=2)
---> 91 return func(*args, **kwargs)
92 wrapper._original_function = func
93 return wrapper

/opt/conda/lib/python3.6/site-packages/keras/engine/training.py in fit_generator(self, generator, steps_per_epoch, epochs, verbose, callbacks, validation_data, validation_steps, class_weight, max_queue_size, workers, use_multiprocessing, shuffle, initial_epoch)
1416 use_multiprocessing=use_multiprocessing,
1417 shuffle=shuffle,
-> 1418 initial_epoch=initial_epoch)
1419
1420 @interfaces.legacy_generator_methods_support

/opt/conda/lib/python3.6/site-packages/keras/engine/training_generator.py in fit_generator(model, generator, steps_per_epoch, epochs, verbose, callbacks, validation_data, validation_steps, class_weight, max_queue_size, workers, use_multiprocessing, shuffle, initial_epoch)
179 batch_index = 0
180 while steps_done < steps_per_epoch:
--> 181 generator_output = next(output_generator)
182
183 if not hasattr(generator_output, 'len'):

in generate(self, train)
157 if self.vflip_prob > 0:
158 img, y = self.vertical_flip(img, y)
--> 159 y = self.bbox_util.assign_boxes(y)
160 inputs.append(img)
161 targets.append(y)

/kaggle/working/ssd_utils.py in assign_boxes(self, boxes)
147 :4]
148 assignment[:, 4][best_iou_mask] = 0
--> 149 assignment[:, 5:-8][best_iou_mask] = boxes[best_iou_idx, 4:]
150 assignment[:, -8][best_iou_mask] = 1
151 return assignment

ValueError: shape mismatch: value array of shape (4,2) could not be broadcast to indexing result of shape (4,1)

TypeError: 'module' object is not callable

但我在 jupyter中运行SSD.ipynb 是出现错误,不知道如何解决。代码如下:
input_shape=(300, 300, 3)
model = SSD300(input_shape, num_classes=NUM_CLASSES)
model.load_weights('weights.04-2.13.hdf5', by_name=True)
bbox_util = BBoxUtility(NUM_CLASSES)

错误信息如下:


TypeError Traceback (most recent call last)
in
1 input_shape=(300, 300, 3)
----> 2 model = SSD300(input_shape, num_classes=NUM_CLASSES)
3 model.load_weights('/home/syk/jupyter/SSD_keras/weights.04-2.13.hdf5', by_name=True)
4 bbox_util = BBoxUtility(NUM_CLASSES)

~/jupyter/SSD_keras/ssd.py in SSD300(input_shape, num_classes)
256 net['conv8_2_mbox_loc_flat'],
257 net['pool6_mbox_loc_flat']],
--> 258 mode='concat', concat_axis=1, name='mbox_loc')
259 net['mbox_conf'] = merge([net['conv4_3_norm_mbox_conf_flat'],
260 net['fc7_mbox_conf_flat'],

TypeError: 'module' object is not callable

测试时跑不通

File "C:\Users\Administrator\Desktop\SSD_keras-master\SSD_keras-master\ssd_layers.py", line 47, in call
output = K.l2_normalize(x, 3)

File "C:\Program Files\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py", line 3157, in l2_normalize

TypeError: l2_normalize() got an unexpected keyword argument 'axis'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.