forresti / SqueezeNet

SqueezeNet: AlexNet-level accuracy with 50x fewer parameters
BSD 2-Clause "Simplified" License
2.17k stars 723 forks source link

Update README with community implementation link #55

Closed vonclites closed 6 years ago

vonclites commented 6 years ago

Hello, Would you like to include my implementation using Tensorflow? I use some cool tricks, like slim's "@argscope" annotation to create a custom tensorflow layer, and mid to high level Tensorflow APIs such as the new tf.data API. Might be a helpful reference point for people trying to write Tensorflow code without a lot of boilerplate.

For example, here's your fire module:

@add_arg_scope
def fire_module(inputs,
                squeeze_depth,
                expand_depth,
                reuse=None,
                scope=None):
    with tf.variable_scope(scope, 'fire', [inputs], reuse=reuse):
        with arg_scope([conv2d, max_pool2d]):
            net = _squeeze(inputs, squeeze_depth)
            net = _expand(net, expand_depth)
        return net

def _squeeze(inputs, num_outputs):
    return conv2d(inputs, num_outputs, [1, 1], stride=1, scope='squeeze')

def _expand(inputs, num_outputs):
    with tf.variable_scope('expand'):
        e1x1 = conv2d(inputs, num_outputs, [1, 1], stride=1, scope='1x1')
        e3x3 = conv2d(inputs, num_outputs, [3, 3], scope='3x3')
    return tf.concat([e1x1, e3x3], 1)
forresti commented 6 years ago

Thanks for your contribution!