Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A tensorflow2 implementation of some basic CNNs(MobileNetV1/V2/V3, EfficientNet, ResNeXt, InceptionV4, InceptionResNetV1/V2, SENet, SqueezeNet, DenseNet, ShuffleNetV2, ResNet).

License

NotificationsYou must be signed in to change notification settings

calmiLovesAI/Basic_CNNs_TensorFlow2

Repository files navigation

A tensorflow2 implementation of some basic CNNs.

Networks included:

Other networks

For AlexNet and VGG, see :https://github.com/calmisential/TensorFlow2.0_Image_Classification
For InceptionV3, see :https://github.com/calmisential/TensorFlow2.0_InceptionV3
For ResNet, see :https://github.com/calmisential/TensorFlow2.0_ResNet

Train

  1. Requirements:
  • Python >= 3.9
  • Tensorflow >= 2.7.0
  • tensorflow-addons >= 0.15.0
  1. To train the network on your own dataset, you can put the dataset under the folderoriginal dataset, and the directory should look like this:
|——original dataset   |——class_name_0   |——class_name_1   |——class_name_2   |——class_name_3
  1. Run the scriptsplit_dataset.py to split the raw dataset into train set, valid set and test set. The dataset directory will be like this:
|——dataset  |——train       |——class_name_1       |——class_name_2       ......       |——class_name_n  |——valid       |——class_name_1       |——class_name_2       ......       |——class_name_n  |—-test       |——class_name_1       |——class_name_2       ......       |——class_name_n
  1. Runto_tfrecord.py to generate tfrecord files.
  2. Change the corresponding parameters inconfig.py.
  3. Runshow_model_list.py to get the index of model.
  4. Runpython train.py --idx [index] to start training.
    If you want to train theEfficientNet, you should change the IMAGE_HEIGHT and IMAGE_WIDTH before training.
  • b0 = (224, 224)
  • b1 = (240, 240)
  • b2 = (260, 260)
  • b3 = (300, 300)
  • b4 = (380, 380)
  • b5 = (456, 456)
  • b6 = (528, 528)
  • b7 = (600, 600)

Evaluate

Runpython evaluate.py --idx [index] to evaluate the model's performance on the test dataset.

Different input image sizes for different neural networks

TypeNeural NetworkInput Image Size (height * width)
MobileNetMobileNet_V1(224 * 224)
MobileNet_V2(224 * 224)
MobileNet_V3(224 * 224)
EfficientNetEfficientNet(B0~B7)/
ResNeXtResNeXt50(224 * 224)
ResNeXt101(224 * 224)
SEResNeXtSEResNeXt50(224 * 224)
SEResNeXt101(224 * 224)
InceptionInceptionV4(299 * 299)
Inception_ResNet_V1(299 * 299)
Inception_ResNet_V2(299 * 299)
SE_ResNetSE_ResNet_50(224 * 224)
SE_ResNet_101(224 * 224)
SE_ResNet_152(224 * 224)
SqueezeNetSqueezeNet(224 * 224)
DenseNetDenseNet_121(224 * 224)
DenseNet_169(224 * 224)
DenseNet_201(224 * 224)
DenseNet_269(224 * 224)
ShuffleNetV2ShuffleNetV2(224 * 224)
ResNetResNet_18(224 * 224)
ResNet_34(224 * 224)
ResNet_50(224 * 224)
ResNet_101(224 * 224)
ResNet_152(224 * 224)

References

  1. MobileNet_V1:Efficient Convolutional Neural Networks for Mobile Vision Applications
  2. MobileNet_V2:Inverted Residuals and Linear Bottlenecks
  3. MobileNet_V3:Searching for MobileNetV3
  4. EfficientNet:EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks
  5. The official code of EfficientNet:https://github.com/tensorflow/tpu/tree/master/models/official/efficientnet
  6. ResNeXt:Aggregated Residual Transformations for Deep Neural Networks
  7. Inception_V4/Inception_ResNet_V1/Inception_ResNet_V2:Inception-v4, Inception-ResNet and the Impact of Residual Connectionson Learning
  8. The official implementation of Inception_V4:https://github.com/tensorflow/models/blob/master/research/slim/nets/inception_v4.py
  9. The official implementation of Inception_ResNet_V2:https://github.com/tensorflow/models/blob/master/research/slim/nets/inception_resnet_v2.py
  10. SENet:Squeeze-and-Excitation Networks
  11. SqueezeNet:SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and <0.5MB model size
  12. DenseNet:Densely Connected Convolutional Networks
  13. https://zhuanlan.zhihu.com/p/37189203
  14. ShuffleNetV2:ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design
  15. https://zhuanlan.zhihu.com/p/48261931
  16. ResNet:Deep Residual Learning for Image Recognition
  17. RegNet:Designing Network Design Spaces

About

A tensorflow2 implementation of some basic CNNs(MobileNetV1/V2/V3, EfficientNet, ResNeXt, InceptionV4, InceptionResNetV1/V2, SENet, SqueezeNet, DenseNet, ShuffleNetV2, ResNet).

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2026 Movatter.jp