Skip to content

Detailed documentation: step by step for Ratings

Katherine Wolcott edited this page Oct 29, 2024 · 6 revisions

Classification for image tagging: step-by-step documentation with input and output files

Image Quality Ratings
For additional information, see github.com/aubricot/computer_vision_with_eol_images.
29 Oct 2024

Model used for final tags
MobileNet SSD v2 attempt 18

Only do Steps 1-3 if training new object detector. To run images through pre-trained EOL object detector, proceed to Step 4.


Step 1) Pre-process training data in Google Drive

Script(s)

rating_preprocessing.ipynb

Input file(s)

image_ratings.txt images_selected_as_exemplar.txt

Output file(s)

Training data
 |-rating
   |-images
      |-1
      |-2
      |-3
      |-4
      |-5
      |-agg
         |-bad
         |-good
   |-images
      |-image_data
         |-bundles
            |-one_download.txt
            |-one_download_7k.txt
            |-two_download.txt
            |-two_download_7k.txt             |-three_download.txt
            |-three_download_7k.txt             |-four_download.txt
            |-four_download_7k.txt             |-five_download.txt
            |-five_download_7k.txt

Detailed steps

Download 7,000 images from EOL user generated quality rating and exemplar image bundles to Google Drive into folders by rating class from 1 (bad) to 5 (good). Then, delete all downloaded non-image files. Initial training attempts on all five classes were not consistent, so classes are aggregated into bad (classes 1 and 2) and good (classes 4 and 5) in the last step.


Step 2) Build & train classification models

Script(s)

rating_train.ipynb

Input file(s)

Training data
 |-rating
   |-images
      |-agg
         |-bad
         |-good

Output file(s)

 |-rating
   |-saved_models
   |-train_graphs

Detailed steps

After preparing the training dataset in Google Drive in Step 1, build and train classification models using rating_train.ipynb. Form fields and dropdown menus within the notebook walk you through model selection, adjusting hyperparameters, training, and the display of trained models. After training is finished, choose the N-best models based on accuracy values and optimal learning (minimizing over/underfit) by inspecting train_graphs for each training session. Keep trying new training attempts with adjusted hyperparameters until desired results are acheived.


Step 3) Determine model prediction confidence thresholds to use for classification

Script(s)

inspect_train_results.ipynb

Input file(s)

 |-rating
Saved models
   |-saved_models
Test images
   |-images
      |-agg
         |-bad
         |-good

Output file(s)

 |-rating
   |-inspect_resul

Detailed steps

Review false and positive detections by class for all N-best attempts/models chosen in Step 2. Select trained model and prediction confidence threshold values to use for classifying quality ratings for EOL images. Threshold values should be chosen that maximize coverage and minimize error. Classification error was low for "bad" image predictions, but high for "good" image predictions. This matches our observation that users were more conflicted on what makes a good image than a bad one, so it's logical that the model would reproduce this behavior. As a result, MobileNet SSDv2 training attempt 18 (output=bad, confidence>1.5) was selected to generate tags for "bad" images which will be pushed to the back of galleries to help in quality sorting.


To run images through pre-trained EOL object detector, follow steps below
--<>--<>--<>--<>--<>--<>--<>--<>--<>--<>--<>--<>--<>---

Step 4) Classify images, post-process results, and display outcomes

Script(s)

classify_images.ipynb

Input file(s)

Saved Models
 |-rating
   |-saved_models
https://editors.eol.org/other_files/bundle_images/files/images_for_Chiroptera_20K_breakdown_000031.txt

Output file(s)

 |-rating
   |-results
      |-tags_rating_20k_a.tsv
      |-tags_rating_20k_b.tsv
      |-tags_rating_20k_c.tsv
      |-tags_rating_20k_d.tsv
      |-tags_rating_20k_finaltags.tsv

Detailed steps

Run images through classification model selected in Step 2. Then post-process results using model prediction and confidence value chosen in Step 3. Display final classification tags on images and verify that they are as expected (or further fine-tune confidence thresholds).

Clone this wiki locally