GithubHelp home page GithubHelp logo

gmurro / food-recognition Goto Github PK

View Code? Open in Web Editor NEW
13.0 3.0 2.0 1.71 GB

Image-based food segmentation for Deep Learning class at @UNIBO

License: MIT License

Jupyter Notebook 99.41% Python 0.29% TeX 0.30%
deep-learning cnn-keras segmentation food-recognition

food-recognition's Introduction

πŸ• Food Recognition πŸ—

Open In Colab

This repository contains a project realized as part of the Deep Learning exam of the Master's degree in Artificial Intelligence, University of Bologna.

The Food Recognition challenge is a competition hosted by AIcrowd, where participants should deal with an image segmentation problem aiming to recognize individual food items in each image.

The goal of this challenge is to train models which can look at images of food items and detect the individual food items present in them.

Repository structure

.
β”œβ”€β”€ assets 
β”‚   └── img                        # Images used in the report
β”œβ”€β”€ report                         # Documentation of the project in pdf format
β”œβ”€β”€ data                           # Dataset used for training, validation and testing
β”‚   β”œβ”€β”€ train 
β”‚   β”œβ”€β”€ val 
β”‚   └── test
β”œβ”€β”€ src                            # Source files 
β”‚   β”œβ”€β”€ test_scripts               # Test files used to verify the correctness of custom functions
β”‚   β”œβ”€β”€ utils 
β”‚   β”‚   └── segmentation_utils.py  # Utility functions used into notebooks
β”‚   β”œβ”€β”€ models                     # Contains the notebooks used for the training of each model
β”‚   β”‚   β”œβ”€β”€ model_A 
β”‚   β”‚   β”œβ”€β”€ model_B 
β”‚   β”‚   β”œβ”€β”€ model_C
β”‚   β”‚   └── model_D
β”‚   └── EvalFoodRecognition.ipynb  # Notebook used for the evaluation of all models            
β”‚
β”œβ”€β”€ LICENSE
└── README.md

Prerequisites

It is needed to install pycocotools to execute the notebooks. You can get it from pip or from the original repo To install on Windows, you can use Anaconda environment and you must have the Visual C++ 2015 build tools:

  1. Clone the repo
  2. Create a new environment: conda create -n deep
  3. Activate the environment: activate deep
  4. Install requirements: pip install -r requirements.txt
  5. inside PythonAPI folder, we can find setup.py file. Open the file and delete the following line:
    extra_compile_args=[β€˜-Wno-cpp’, β€˜-Wno-unused-function’, β€˜-std=c99’]
  6. run command python setup.py build_ext install
  7. run command python setup.py build_ext --inplace

Dataset

The dataset for the AIcrowd Food Recognition Challenge is available at https://www.aicrowd.com/challenges/food-recognition-challenge/dataset_files

This dataset contains :

  • train-v0.4.tar.gz : This is the Training Set of 24120 (as RGB images) food images, along with their corresponding 39328 annotations in MS-COCO format
  • val-v0.4.tar.gz: This is the suggested Validation Set of 1269 (as RGB images) food images, along with their corresponding 2053 annotations in MS-COCO format
  • test_images-v0.4.tar.gz : This is the debug Test Set for Round-3, where you are provided the same images as the validation set.

Evaluation Criteria

In order to evaluate results produced by different models there were used three metrics:

  • IoU (Intersection Over Union)
  • Precision
  • Recall

For same categories the accuracy of the prediction is very high, instead other categories seems to be very hard to recognize. IoU

Results

The best model is the last (called Model D), and it works quite well also at runtime detecting food segmentations from a video with an acceptable frame rate.

Apple segmentation

Resources & Libraries

  • pycocotools API
  • Tensorflow + Keras

Versioning

We use Git for versioning.

Group members

Reg No. Name Surname Email Username
997317 Giuseppe Murro [email protected] gmurro
985203 Salvatore Pisciotta [email protected] SalvoPisciotta

License

This project is licensed under the MIT License - see the LICENSE file for details

food-recognition's People

Contributors

gmurro avatar salvopisciotta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

food-recognition's Issues

Discrepancy Between cat_names in Training and Predictions

Hello,

I noticed a discrepancy in the cat_names between the training phase and the prediction phase (in the files /src/models/model_D and /src/test_scripts/video_segmenation.py). The problem I ran into is that the class names in my cat_names list appear to be different during prediction compared to what was used during training.

I would like to understand why this difference exists and how it might affect the accuracy of my model. Apologies for what may seem like a beginner's question as I am new to Python. Could you provide some information on the source of this discrepancy? It is important to me to ensure consistency between the class names used in training and those used for predictions.

Thank you for your help.

Best Regards,
Serhii

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.