Closed GotG closed 4 years ago
Hi, @GotG Thanks for your trying! This repos is designed for yolov3/yolov3spp/yolov4. And it doesn't support v3/v4-tiny.Because v3/v4-tiny's structure is very simple.We only need to modify the code https://github.com/mystic123/tensorflow-yolo-v3/blob/master/yolo_v3_tiny.py for yolov3-tiny and https://github.com/TNTWEN/OpenVINO-YOLOV4/blob/master/yolo_v4_tiny.py for yolov4-tiny if you know how tf1.x implement yolo. It will not cost much time compared with v3/v3-spp/v4 to modified the tf's code . Maybe this url will help you know how mystic123 implement yolov3/v3-tiny in TF-Slim. Maybe in the future, when I am free, I will add support for tiny model parsing.^-^
Yes, agreed. I modified the code from mystic123 to this. This modification gives a .pb that detects the boxes, although they are of a wrong size.
` with tf.variable_scope('yolo-v3-tiny'):
for i in range(6):
# inputs = _conv2d_fixed_padding(
# inputs, 14 * pow(2, i), 3)
if i == 0:
inputs = _conv2d_fixed_padding(
inputs, 13, 3)
if i == 1:
inputs = _conv2d_fixed_padding(
inputs, 26, 3)
if i == 2:
inputs = _conv2d_fixed_padding(
inputs, 51, 3)
if i == 3:
inputs = _conv2d_fixed_padding(
inputs, 102, 3)
if i == 4:
inputs = _conv2d_fixed_padding(
inputs, 205, 3)
route_1 = inputs
if i == 5:
inputs = _conv2d_fixed_padding(
inputs, 410, 3)
inputs = slim.max_pool2d(
inputs, [2, 2], stride=1, padding="SAME", scope='pool2')
else:
inputs = slim.max_pool2d(
inputs, [2, 2], scope='pool2')
inputs = _conv2d_fixed_padding(inputs, 819, 3)
inputs = _conv2d_fixed_padding(inputs, 205, 1)
# inputs = _conv2d_fixed_padding(inputs, 896, 3)
# inputs = _conv2d_fixed_padding(inputs, 224, 1)
route_2 = inputs
inputs = _conv2d_fixed_padding(inputs, 410, 3)
# inputs = _conv2d_fixed_padding(inputs, 448, 3)
# inputs = _conv2d_fixed_padding(inputs, 255, 1)
detect_1 = _detection_layer(
inputs, num_classes, _ANCHORS[3:6], img_size, data_format)
detect_1 = tf.identity(detect_1, name='detect_1')
inputs = _conv2d_fixed_padding(route_2, 102, 1)
# inputs = _conv2d_fixed_padding(route_2, 112, 1)
upsample_size = route_1.get_shape().as_list()
inputs = _upsample(inputs, upsample_size, data_format)
inputs = tf.concat([inputs, route_1],
axis=1 if data_format == 'NCHW' else 3)
inputs = _conv2d_fixed_padding(inputs, 205, 3)
# inputs = _conv2d_fixed_padding(inputs, 224, 3)
# inputs = _conv2d_fixed_padding(inputs, 255, 1)
detect_2 = _detection_layer(
inputs, num_classes, _ANCHORS[0:3], img_size, data_format)
detect_2 = tf.identity(detect_2, name='detect_2')
detections = tf.concat([detect_1, detect_2], axis=1)
detections = tf.identity(detections, name='detections')
return detections `
I would think your code would work as well with some small modifications. Maybe I should try that
Hello
My custom yolov3tiny config does convert to pb then to xml and bin but I get no detections when running the python yolo demo from OpenVINO. I used TF 1.15.2.
Link below has the weights and the cfg:
https://drive.google.com/file/d/1PnsxwNKIMugR2zvi24lx3uQX51wr1GN2/view?usp=sharing
Thanks!