This project is devoted to artist identification from a painting.
There are 49 famous artists from all over the world. It was taken from https://www.kaggle.com/ikarus777/best-artworks-of-all-time. Dataset was divided by train, val and test sets using script create_dataest.py
.
I used pretrained ResNet, Adam optimizer. There were two expirements with it:
- The last layer was changed for linear with 49 classes and model was trained for picture dataset from kaggle. Classes slightly inbalance therefore
weighted accuracy
was used. Loss function wasCrossEntropyLoss
. The accuracy is 0.71. - The last layer was changed to
nn.Sequential(nn.Linear(2048, num_ftrs), nn.ReLU(), nn.Dropout(0.2), nn.Linear(num_ftrs, num_classes), nn.LogSoftmax(dim=1))
. Loss function wasNLLLoss
. The accuracy is 0.66 (you can see this model in Notebook).
Also there were several expirements with different transformations but it didn't improve the quality of the model.
In current application the simpliest model with linear the last layer is used.
- clone the repository
git clone https://github.com/tylinka/artists_identification
- go to project's folder and run
docker build . -t deploy_flask
- launch by
docker run -p 5000:5000 -t -i deploy_flask:latest
- in web browser
http://127.0.0.1:5000/
Select one painting from test folder and upload it. Then press button "identify". On the next page the name of artist will appear. Also you can find any picture in web. Pictures from test folder weren't involve in model training.
HTML frontend (folder "template"):
Attention: on Mac with M1 this application can work unstable ([W NNPACK.cpp:79] Could not initialize NNPACK! Reason: Unsupported hardware.)