This is a capstone project for advanced track of the MIPT Deep Learning School (Fall-2020).
Flask-detector
is a web application for object detection consisting of following components
- Flask
- Redis server
- RQ (Redis Queue)
- Pretrained MMdetection model
Mask-RCNN-R50
A user uploads a picture and gets back a detected image. The result can be downloaded.
-
Clone the repository with
git clone https://github.com/biomlds/flask_detector.git
andcd flask_detector/
-
- Install Docker
docker build --rm -t flask-detector .
docker run -p 5000:5000 -it flask-detector
- Open http://0.0.0.0:5000
-
heroku create -a flask-detector
heroku container:push -a flask-detector web
- Set a secret key:
heroku config:set -a flask-detector SECRET_KEY=Your_Secret_Key
heroku container:release -a flask-detector web
heroku open
or open https://flask-detector.herokuapp.com
NOTE:
- As a prove of concept, the app was deployed on a free
heroku
dyno: https://flask-detector.herokuapp.com. - Due to 500 Mb RAM limit of the free
heroku
instance it tends to crash. For stable work either use the docker container or deploy on a server with 1Gb+ of RAM. flask-detector
was tested in a local docker container.
MMDetection is an open-source object detection toolbox based on PyTorch
. It comes with a zoo of model pretrained on the COCO dataset. This dataset includes 80 categories captured from everyday scenes. The full list of labels is available here.
This App make use of pretrained Mask R-CNN R-50 FPN
model pretrained on the COCO dataset. As a result, there is no big surprise it performs well on pictures taken in a daily setting, while poorly in less common scenes (e.g., zoo or diving).
Following pictures contained objects from the COCO dataset and were successfully identified:
When it comes to unusual surroudings, the model performance suffers. Let's consider following examples:
While the model is able to recognize a diver, it fails to detect a fish (e.g. diving1) or even misidentify it as a bird (diving2)
Sometimes the network produces conflicting result for the same class of objects it never saw. For example, lemurs are classified as a cat, dog and bird as those examples were in the training dataset:
Referred images are in the test_images subfolder.
All in all, it is clear that fine tuning is required to adapt the model to a specific domain. For example, to improve performance of the neural net on the above mentioned pictures, it shold be trained on a dataset of animals.