Efficient-AI-Backbones icon indicating copy to clipboard operation
Efficient-AI-Backbones copied to clipboard

how to train ghostnet?

Open gtfaiwxm opened this issue 5 years ago • 12 comments

how to train ghostnet in my dataset?

gtfaiwxm avatar Mar 02 '20 06:03 gtfaiwxm

I think you have the training example for your dataset. Just replace your network with GhostNet and train it.

iamhankai avatar Mar 02 '20 07:03 iamhankai

OK,thanks

gtfaiwxm avatar Mar 02 '20 08:03 gtfaiwxm

OK,thanks

Hi , I was going to replace my network with Ghostnet but it keep throwing bug in tensorpack part. This example works fine with MobileNetv2. File "/media/e/hujiang/anaconda3/envs/tf/lib/python3.6/site-packages/tensorpack/models/batch_norm.py", line 176, in BatchNorm training = ctx.is_training AttributeError: 'NoneType' object has no attribute 'is_training'

Can you tell me how you handle it ?

JayFu avatar Mar 13 '20 13:03 JayFu

What's the version of your tensorflow and tensorpack? I recommend TensorFlow-1.13.1, Tensorpack-0.9.7.

iamhankai avatar Mar 14 '20 01:03 iamhankai

What's the version of your tensorflow and tensorpack? I recommend TensorFlow-1.13.1, Tensorpack-0.9.7.

Oh thanks! I was using tf 1.5.0 and tensorpack 0.9.9 indeed. But it seems doesn't work after attempt. Got the same error. Guessing that's because my training example doesn't suit it? Could tell me any recomending training example?

JayFu avatar Mar 14 '20 09:03 JayFu

You need https://tensorpack.readthedocs.io/tutorial/symbolic.html#use-models-outside-tensorpack

ppwwyyxx avatar Mar 14 '20 12:03 ppwwyyxx

Thanks @ppwwyyxx

iamhankai avatar Mar 14 '20 14:03 iamhankai

@ppwwyyxx TY

JayFu avatar Mar 16 '20 00:03 JayFu

@gtfaiwxm Have you known how to train the Ghostnet?

KnightWin123 avatar Mar 18 '20 13:03 KnightWin123

Hi @iamhankai thanks for sharing this good work. I success training GhostNet 1.3x to 75.78/92.77 top1/top5, it's almost your paper mentioned. Details here But I use the same training setting with I train MobileNetV3 with some tricks Label smoothing, No decay bias and Dropout. I see your paper and reply in https://github.com/iamhankai/ghostnet.pytorch/issues/18#, it's seem that you don't use any tricks when training this. I've tried MobileNetV3 can't get such high accuracy leaving these tricks. I wonder what tricks when training, if it's possible I remove these and get same result?

PistonY avatar Sep 28 '20 03:09 PistonY

@PistonY Thanks for you attention. We trained GhostNet using the tricks similar to MobileNetV3 paper, including Label smoothing, No decay bias and Dropout.

iamhankai avatar Sep 28 '20 09:09 iamhankai

from tensorpack import TowerContext
with TowerContext('', is_training=False):
    model = GhostNet(....)
    model.data_format = 'NHWC'
    image_tensor = tf.placeholder(dtype=np.float32, shape=(7, 320, 320, 3), name='image_tensor')
    logits = model.get_logits(image_tensor)
    print(logits)

ghost avatar Nov 11 '20 08:11 ghost