Skip to content

lmqZach/Pixel-Classification

Repository files navigation

PixelClassification

File Structure

|-- ROOT
  |-- README.md
  |-- PixelClassifier_Report.pdf
  |-- Pipfile
  |-- requirements.txt
  |-- run_tests.py
  |-- tests
  |   |-- test_simple.py
  |   |-- testset
  |-- pixel_classification
  |   |-- data.zip
  |   |-- generate_rgb_data.py
  |   |-- pixel_classifier.py
  |   |-- pixel_weight.npy
  |   |-- requirements.txt
  |   |-- test_pixel_classifier.py

Report

Objective

Train a probabilistic color model from pixel data to distinguish among red, green, and blue pixels.

Detailed Tasks

Screen Shot 2022-05-09 at 16 21 50

Problem Formulation

Consider we have an pixel X with 3 layers of colors: (R, G, B), and we need to identify which color it belongs to. Let the true image colors to be an 3 ∗ 1 one-hot encoder Y . We want to train a 3 ∗ 3 weight w which project X into Yˆ depending on XT ∗ w, which is the probabilistic prediction. The goal is finding w s.t. min|Yˆ − Y |.

For color classification, we want to generate a 3 ∗ 3 weight w to minimize the loss. Hence, we are using the following algorithm for training.

Algorithm

Since we only generate the probability of our model output, we use argmax to get the position of probability. For example, if the probability we generate is [0.8, 0.1, 0.1], the agrmax output would be [1, 0, 0].

Screen Shot 2022-05-09 at 16 30 11

Results

For Pixel Classification, the train pre- cision is 0.9926908500270709; validation result is 0.975904; and test result is 9.879518072289157/10.

About

Train a probabilistic color model from pixel data to distinguish among red, green, and blue pixels.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages