donkeycar icon indicating copy to clipboard operation
donkeycar copied to clipboard

adding resnet18 support

Open cl3m3nt opened this issue 3 years ago • 6 comments

Adding pre-trained Resnet18 model for transfer learning. Model has been trained using CIFAR100 coarse (20 super classes).

Changes are the following:

  • adding keras_resnet18.py part (a full "manual implementation of resnet18 as it's not available from keras applications)
  • updating keras.py part to load keras_resnet18 part & define Resnet18LinearKeras and Resnet18CategoricalKeras classes
  • updating tflite.py part to optionally take into account inference on TPU Edge
  • updating utils.py to take into account new model type (resnet18)
  • updating train.py to take into account new model type (resnet18)

cl3m3nt avatar Dec 10 '20 09:12 cl3m3nt

Hi @cl3m3nt - do you still want to pursue this? We have a reset 18 in pytorch now, but there is no harm having this in tf, too?

DocGarbanzo avatar Jan 16 '21 14:01 DocGarbanzo

@cl3m3nt this looks great and I believe a lot of people would like to see this merged. Do you have time to work on this?

sctse999 avatar Jan 27 '21 04:01 sctse999

We already have Resnet18 with PyTorch now. FYI

tikurahul avatar Jan 27 '21 05:01 tikurahul

Thanks @sctse999. Yes I could find some extra time to update it so that it meets @DocGarbanzo guidance. But I would also need to adapt taking into account last dev significant updates. I need to evaluate the effort before. Also I was considering making a PR to keras team so that Resnet18 would be available natively out from tf.keras.applications. Let me take some time to rethink about that.

cl3m3nt avatar Jan 27 '21 17:01 cl3m3nt

We already have Resnet18 with PyTorch now. FYI

Thanks @tikurahul for the heads up. I'll figure out whether I can update anyway this PR so that Resnet18 is available from keras as well. Meanwhile, do you think that mobilenetv2 would make sense to be available ? Resnet18 got 7 Millions parameters vs Mobilenet which comes 2.2 Millions only. Might be interesting to have it as well to decrease latency when using Transfer Learning. What do you think ?

cl3m3nt avatar Jan 27 '21 17:01 cl3m3nt

Great I would love to see resnet18 or mobilenetv2 on keras as well.

sctse999 avatar Jan 28 '21 03:01 sctse999