Skip to content

openfoodfacts/off-category-classification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Open Food Facts Category Classification

This repository contains the code to train a multi-label category classifier for Open Food Facts products.

It works within Robotoff, currently using product_name and ingredients_tags.

Sources

download.sh can help you download extra data.

experiments/Train.ipynb is the notebook to train the model. It can last for several hours depending on your machine.

Threshold.ipynb notebook tries to measure performance to understand where to set threshold for automatic classification. Results are summarized in 2021-10-15-kulizhsy-category-classifier-performance.pdf

Contributing

A Data for Good to add more features to the model has been initiated. You can find things to help with on issue What can I work on ?

Open Train.py In Colab

Running jupyter notebook with docker

On first install, or requirements or Dockerfile changes (or in case of doubt), run:

docker-compose build

Then simply run:

docker-compose up

Look at url displayed on console to open the notebook

Deploying to production

Dev install

If you want to develop, here is a sample install using virtual envs.

Install needed dependencies:

On ubuntu :

sudo apt install python3-venv python3-dev build-essential

Create a virtual environment: python3 -m venv .venv

Activate the virtual environment (you will have to activate every time you use the project):

. .venv/bin/activate

Install requirement and eventually requirement-dev

pip install -r requirements.txt
pip install -r requirements-dev.txt

To launch jupyter notebook, just use (after activating your virtual env):

jupyter notebook