All Projects → Apm5 → Imagenet_resnet_tensorflow2.0

Apm5 / Imagenet_resnet_tensorflow2.0

Train ResNet on ImageNet in Tensorflow 2.0; ResNet 在ImageNet上完整训练代码

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Imagenet resnet tensorflow2.0

Pytorch2keras
PyTorch to Keras model convertor
Stars: ✭ 676 (+1509.52%)
Mutual labels:  resnet, imagenet
SAN
[ECCV 2020] Scale Adaptive Network: Learning to Learn Parameterized Classification Networks for Scalable Input Images
Stars: ✭ 41 (-2.38%)
Mutual labels:  imagenet, resnet
Octconv.pytorch
PyTorch implementation of Octave Convolution with pre-trained Oct-ResNet and Oct-MobileNet models
Stars: ✭ 229 (+445.24%)
Mutual labels:  resnet, imagenet
Pytorch Imagenet Cifar Coco Voc Training
Training examples and results for ImageNet(ILSVRC2012)/CIFAR100/COCO2017/VOC2007+VOC2012 datasets.Image Classification/Object Detection.Include ResNet/EfficientNet/VovNet/DarkNet/RegNet/RetinaNet/FCOS/CenterNet/YOLOv3.
Stars: ✭ 130 (+209.52%)
Mutual labels:  resnet, imagenet
pytorch2keras
PyTorch to Keras model convertor
Stars: ✭ 788 (+1776.19%)
Mutual labels:  imagenet, resnet
Iresnet
Improved Residual Networks (https://arxiv.org/pdf/2004.04989.pdf)
Stars: ✭ 163 (+288.1%)
Mutual labels:  resnet, imagenet
Pyramidnet Pytorch
A PyTorch implementation for PyramidNets (Deep Pyramidal Residual Networks, https://arxiv.org/abs/1610.02915)
Stars: ✭ 234 (+457.14%)
Mutual labels:  resnet, imagenet
Resnet Imagenet Caffe
train resnet on imagenet from scratch with caffe
Stars: ✭ 105 (+150%)
Mutual labels:  resnet, imagenet
ModelZoo.pytorch
Hands on Imagenet training. Unofficial ModelZoo project on Pytorch. MobileNetV3 Top1 75.64🌟 GhostNet1.3x 75.78🌟
Stars: ✭ 42 (+0%)
Mutual labels:  imagenet, resnet
simpleAICV-pytorch-ImageNet-COCO-training
SimpleAICV:pytorch training example on ImageNet(ILSVRC2012)/COCO2017/VOC2007+2012 datasets.Include ResNet/DarkNet/RetinaNet/FCOS/CenterNet/TTFNet/YOLOv3/YOLOv4/YOLOv5/YOLOX.
Stars: ✭ 276 (+557.14%)
Mutual labels:  imagenet, resnet
Imagenet
This implements training of popular model architectures, such as AlexNet, ResNet and VGG on the ImageNet dataset(Now we supported alexnet, vgg, resnet, squeezenet, densenet)
Stars: ✭ 126 (+200%)
Mutual labels:  resnet, imagenet
Mmclassification
OpenMMLab Image Classification Toolbox and Benchmark
Stars: ✭ 532 (+1166.67%)
Mutual labels:  resnet, imagenet
Pyramidnet
Torch implementation of the paper "Deep Pyramidal Residual Networks" (https://arxiv.org/abs/1610.02915).
Stars: ✭ 121 (+188.1%)
Mutual labels:  resnet, imagenet
Senet Caffe
A Caffe Re-Implementation of SENet
Stars: ✭ 169 (+302.38%)
Mutual labels:  resnet, imagenet
Ir Net
This project is the PyTorch implementation of our accepted CVPR 2020 paper : forward and backward information retention for accurate binary neural networks.
Stars: ✭ 119 (+183.33%)
Mutual labels:  resnet, imagenet
Fusenet
Deep fusion project of deeply-fused nets, and the study on the connection to ensembling
Stars: ✭ 230 (+447.62%)
Mutual labels:  resnet, imagenet
Caffe Model
Caffe models (including classification, detection and segmentation) and deploy files for famouse networks
Stars: ✭ 1,258 (+2895.24%)
Mutual labels:  resnet, imagenet
Pytorch Classification
Classification with PyTorch.
Stars: ✭ 1,268 (+2919.05%)
Mutual labels:  resnet, imagenet
PyTorch-LMDB
Scripts to work with LMDB + PyTorch for Imagenet training
Stars: ✭ 49 (+16.67%)
Mutual labels:  imagenet, resnet
Cnn Models
ImageNet pre-trained models with batch normalization for the Caffe framework
Stars: ✭ 355 (+745.24%)
Mutual labels:  resnet, imagenet

Train ResNet on ImageNet in Tensorflow 2.0

Accuracy

Network Center crop @ top-1 10-crop @ top-1
ResNet-18 69.15% 71.60%
ResNet-50 75.96% 77.72%

Meet the accuracy in Deep Residual Learning for Image Recognition.

The weights is provided.

Link: https://pan.baidu.com/s/1nwvkt3Ei5Hp5Pis35cBSmA

Code: y4wo

Requirements

Python version: 3.5.1

Packages:

  • Tensorflow 2.0.0
  • numpy
  • opencv-python
  • tqdm

Dataset

The ImageNet data can be downloaded from http://www.image-net.org/.

Or you can contact me for a download link of Baidu Netdisk.

If you want to train your own data, please modify all the files in data/ and config.py.

Usage

Prepare

All training settings are in config.py. You can change the log_file and save_weight_file to set save path.

To use default config, you should create the directory before training.

mkdir result
mkdir result/log
mkdir result/weight

For the other parameters in config.py, it is not suggested to change them unless you know what you are doing.

Model

Various versions of ResNet, which is 18, 34, 50, 101 and 152, are implemented in Tensorflow 2.0

from model.ResNet import ResNet
model = ResNet(50)

Or you can import the model in keras applications

from tensorflow.keras.applications.resnet50 import ResNet50
model = ResNet50(weights=None)

Set model in train.py, which defaults to ResNet-50 v2.

Training

python3 train.py

My experimental environment is

  • i7-6850K @ 3.6GHz
  • TITAN Xp, 12GB

For ResNet-50, average training speed is 2 iterations per second. So it will take about 3 days to complete the training, which is 50 epochs.

If Allocator (GPU_0_bfc) ran out of memory trying to allocate..., please reduce the batch size.

Test

Set the load_weight_file in config.py.

In test code, images are resized such that the shorter side is 256. Then crop the 224*224 area as the input.

python3 test.py is center crop test.

python3 test_10_crop.py is standard 10-crop test mentioned in Deep Residual Learning for Image Recognition.

python3 test_single_image.py is single image test. Set the image path and model path before run it. The final output is the category name and confidence.

For example, the input image is

input image

and the output is


----------------------------------------
image: ILSVRC2012_val_00000321.JPEG
classification result:computer_keyboard
confidence:0.7444
----------------------------------------

More

Basic tutorial for tensorflow 2.0: https://github.com/Apm5/tensorflow_2.0_tutorial

For chinese friends: 我有一个知乎专栏,里面有中文版本的教程

Contact me: [email protected]

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].