Skip to content

mrernst/ColorConstancyLearning

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Self-Supervised Learning of Color Constancy

This is the code used for the publication "Self-Supervised Learning of Color Constancy" [1]. If you make use of this code please cite as follows:

[1] M. R. Ernst, F. M. López, R. W. Fleming, A. Aubret and J. Triesch, Self-Supervised Learning of Color Constancy, In 2024 IEEE International Conference on Development and Learning (ICDL). IEEE.

A preprint of the paper can also be found at arxiv.

Getting started with the code

Clone the repository from here

  • Make sure you have all the dependencies installed, see also requirements.txt
  • Generate the corresponding color-constancy dataset using Blender and BlenderProc
  • Start an experiment on your local machine or on your ML cluster

Prerequisites

Installation guide

Forking the repository

Fork a copy of this repository onto your own GitHub account and clone your fork of the repository into your computer, inside your favorite folder, using:

git clone "PATH_TO_FORKED_REPOSITORY"

Setting up the environment

Install Python 3.9 and the conda package manager (use miniconda). Navigate to the project directory inside a terminal and create a virtual environment (replace <ENVIRONMENT_NAME>, for example, with CORe50Env) and install the required packages:

conda create -n <ENVIRONMENT_NAME> --file requirements.txt python=3.9

Activate the virtual environment:

source activate <ENVIRONMENT_NAME>

Generating the C3R Dataset

The ColorConstancyCubes (C3) datasets are generated by executing the scripts provided in the folder generating.

In order to generate the data set used in the paper execute python3 generate_C3.py --no-temporal

then move the resulting folder "C3" at "generating/datasets" to "learning/data" in order for the learning script to be directly accepted

Starting an experiment

Starting an experiment is straight forward. Specify your options via the command line and execute the script

Example A) A run with the C3R dataset
python3 main/train.py \
	--name C3R_Exp_0 \                             # specify experiment name
	--data_root './data/' \                         # specify where you put the CORe50 dataset
	--contrast 'time' \                             # choose 'time' or 'combined' for -TT or TT+
	--test_every 10 \                               # test every 10 epochs
Example B) A comparison run with a supervised model
python3 main/train.py \
	--name Supervised_Exp_0 \                       # specify experiment name
	--data_root './data/' \                         # specify where you put the CORe50 dataset
	--contrast 'nocontrast' \                       # choose 'nocontrast' for supervised experiments
	--main_loss 'supervised' \                      # supervised loss
	--test_every 10 \                               # test every 10 epochs

License

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

Releases

No releases published

Packages

No packages published

Languages