tobibaum / metrabs_trt

Running 3D HPE at 30fps
12 stars 3 forks source link

MobileNetV3 backbone support #5

Open moonsh opened 1 year ago

moonsh commented 1 year ago

Thank you for sharing this work. It helps me a lot.

I am trying to use mobilenetv3 backbone but I got some weight size mismatching problems. I used the below additional script for mobilenetv3. Is there something I didn't include ?

elif model_name.startswith('mobilenet'): from options import FLAGS FLAGS.centered_stride = True bn = keras.layers.BatchNormalization

import backbones.mobilenet_v3
class MyLayers(backbones.mobilenet_v3.VersionAwareLayers):
    def __getattr__(self, name):
        if name == 'BatchNormalization':
            return bn
        return super().__getattr__(name)

arch = model_name
arch = arch[:-4] if arch.endswith('mini') else arch
classname = f'MobileNet{arch[len("mobilenet"):]}
mod = getattr(backbones.mobilenet_v3, classname)(
    include_top=False, weights=None, minimalistic=False,
    input_shape=(None, None, 3), layers=MyLayers(),
    centered_stride=FLAGS.centered_stride, pooling=None)
Tikitaka02 commented 6 months ago

I am also trying to do it with mobilenet. Any luck?