Implementing ResNet with Base Line Accuracy
Implementing ResNet with Base Line Accuracy
ResNet Base Line Accuracies
Results Summary & Comparison (Reasons and the Implementations described below)
ResNet 50 Validation Test Results
Data Set: ImageNet Validation data set (50,000 images)
Validation Accuracy (Top1) = 68.084 % with caffe input preprocessing
ResNet 101 Validation Test Results
Data Set: ImageNet Validation data set (50,000 images)
Validation Accuracy (Top1) = 69.976 % with caffe input preprocessing
Base Line Setup Details
- Load the images in the format of RGB channel ordering (size = 224, 224, 3)
- Convert images in to an array
- Expand the image dimension by one
- Preprocess Input (on tf, torch and caffe modes)
Mode is one of "caffe", "tf" or "torch". Defaults to "caffe".
caffe: will convert the images from RGB to BGR, then will zero-center each color channel with respect to the ImageNet dataset, without scaling.
tf: will scale pixels between -1 and 1, sample-wise.
torch: will scale pixels between 0 and 1 and then will normalize each channel with respect to the ImageNet dataset.
5.Call predict
Tested ResNet101 on all 3 input preprocessing modes
- caffe = 71.5% (Top1 Accuracy) with 1000 validation images
- tf = 0.3% (Top1 Accuracy) with 1000 validation images
- torch = 0.89% (Top1 Accuracy) with 1000 validation images
Out of all three modes, caffe mode has the highest accuracy
ResNet Baseline Validation Script TensorFlow 1.15
Install TensorFlow 1.15
- Install python 3.6
- Create a new PyCharm project
- Select python 3.6 interpreter
- Create VENV
- Pip install tensorflow==1.15
Python 3.6
Tensorflow 1.15
Requirements file link
https://github.com/SaralaSewwandi/ResNet-BaseLine-Validation/blob/main/Tensoflow%201.15%20Libray%20Requirements/requirements.txt
Error with resnet decode fix in tensorflow 1.15
resolved AttributeError: 'str' object has no attribute 'decode'
pip install 'h5py==2.10.0' --force-reinstall
Final TensorFlow Script is written in order to eb compatible with both the TensorFlow versions 2 and 1.5
ResNet Baseline Validation Script TensorFlow 2
python 3.9
tensorflow 2.7
Tasks Performed
- Implemented the script for TensorFlow 2 & Tensorflow 1.15
- Tested for all the preprocessing modes for the base line accuracy (TF, TORCH and CAFFE)
- Image size is fine = 224,224,3
- Channel ordering and conversion to RGB to BGR confirmed
- Input Preprocessing Done According to the API
- Inference Validation Script debugged
- Tested for all the details mentioned in the Keras site to reproduce the baseline accuruacy
- Only thing left to check is whether we are evaluating based on the exact validation data set that they were providing the accuracy on.
- We have used the 2012 ImageNet Validation dataset
- However, between 2012, 2014 & 2017 there will be changes in labels (which were corrected over time)
- So ResNet101 and ResNet50 is to be tested on 2014 ImageNet Validation dataset
ImageNet Class IDs with Labels
Official Link (here first line has the value background just to avoid the index 0, and assign the indexes from 1 – 1000 for the imagenet class ids)
Other References
Final Python Scripts
ResNet Validation Script is developed to support both the TensorFlow 2 and Tensorflow1.15 versions
https://github.com/SaralaSewwandi/ResNet-BaseLine-Validation
Comments
Post a Comment