Skip to content

rbiswas143/color-namer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Naming colors with Machine Learning

This work is a re-creation of Micheal A. Alcorn's work on Github. Also checkout his interesting blog post about the same

Objectives

  • Given the name of a color, predict the color (RGB vlaue)
  • Given a color as an RGB value, suggest some new names for it

Neural networks can learn to assign colors to color names and predict new names for colors. The primary challenge that we face in this process is that the largest color database is rather small and most of the words in the vocabulary of the language do not appear in any color name. As such we end up with models with poor generalization to the language. This can, to some extent, be handled by the use of transfer learning. In these experiments, color names have been represented as word embeddings derived from a pre-trained word embeddings dataset. The neural networks learn a mapping between the word embedding and color spaces, which greatly improves the generalization of the models even for out-of-vocabulary words

Datasets

  • Small - 1000+ colors from Sherwin Williams's collection of colors
  • Big - Dictionary of 18,000+ handpicked colors from various sources
  • Word Embeddings - 6B word embeddings from GloVe

Deep Learning Architectures

  • Color Predictions
    • RNN/LSTM based sequence models: These models sequenctially process the words in a color name and predict an RGB value at the last time step
    • CNN model: The input is truncated and padded to a fixed length which is then reduced by a CNN model to an RGB value
  • Color Name Predictions
    • RNN/LSTM based sequence models: These are trained in the style of language modelling where the input to the first time step is a resized color RGB value vector, while the subsequent time steps take as input the output of the previous time step. At each time step a word of the color name is predicted terminating at a fixed length or, optinally, a stop word. During evaluation, we can sample out multiple name predictions using Beam Search

Project Structure

color/data Module for loading datasets and pre-processing
color/models All models and related functionality are defined here
color/utils Progress bar, Visdom plots, and other utilities
color/training.py Abstract training work flow
color/hp_search.py Script to run hyper-parameter search from a hyper-parameter configuration file
notebooks EDA, POCs, Model evaluations and hyper-parameter tuning
datasets Datasets directory (see colors.data module for precise paths and download links)
logs Logs
trained_models Trained models and hyper-parameter configuration are saved here