It is a naive image classifier developed on top of PyTorch. One can train a model and evaluate the performance of the model on a custom dataset by simply calling the train function of this package. An overview of image classification using imgclassifier is available on YouTube.
✔️ Available backbones: ➖ default (resnet18) ➖ alexnet ➖ vgg11 ➖ vgg13 ➖ vgg16 ➖ vgg19 ➖ resnet18 ➖ resnet34 ➖ resnet50 ➖ resnet101 ➖ resnet152 ➖ densenet121 ➖ densenet161 ➖ densenet169 ➖ densenet201 ➖ mobilenet_v2 ➖ mobilenet_v3_large ➖ mobilenet_v3_small ➖ mnasnet1_0 ➖ mnasnet0_5 ➖ shufflenet_v2_x1_0 ➖ resnext101_32x8d ➖ resnext50_32x4d.
✔️ Available Directory Structures: ➖ ImageFolder ➖ Custom.
ImageFolder | Custom |
---|---|
Dataset |
Dataset └── Classes └── images |
✔️ Evaluation Criteria: ➖ Precision ➖ Recall ➖ F1 Score ➖ Accuracy.
!pip install git+https://github.com/mehedihasanbijoy/imgclassifier.git
from imgclassifier import train
model, train_acc, train_loss, test_acc, targets, preds = train(
data_root='/Your/Dataset/Path',
folder_structure='Custom',
df = df,
backbone='resnet18',
transform = transform,
device='cuda' if torch.cuda.is_available() else 'cpu',
epochs=10
)
from imgclassifier import train
model, train_acc, train_loss, test_acc, targets, preds = train(
data_root='/Your/Dataset/Path',
folder_structure='ImageFolder',
backbone='resnet18',
device='cuda' if torch.cuda.is_available() else 'cpu',
epochs=10
)
from imgclassifier import evaluation_report
pr, re, f1, acc = evaluation_report(targets, preds)
https://colab.research.google.com/drive/13pu3Mw7FVPGV-f_g2VhVOMiE-wrhPo3F?usp=sharing
https://colab.research.google.com/drive/1BKg0sFqQsatqQUMT73KrRavhRYLPqsab?usp=sharing
If you find this work useful in your research, please consider citing:
@misc{imgclassifier,
author = {Bijoy, Mehedi Hasan},
title = {imgclassifier: A Python Library for Image Classification},
year = {2022},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/mehedihasanbijoy/imgclassifier}}
}