Giter Club home page Giter Club logo

image-anomaly-detection-with-cnn's Introduction

Image-Anomaly-Detection-With-CNN

This repo contains the slides and Jupyter notebook from Anthony Wang and Alan Wang's final project in MSDS 631 Introduction to Deep Learning at University of San Francisco.

Presentation Slides

Objectives

Our motivation behind this project was to approach object detection from a different perspective. Oftentimes, object detection in deep learning is to train a model that can mimic a human being's object detection ability. The picture below is what a typical object detection model does.

That's a pretty big stick

For many object detection models, the model is considered good enough if it can do what a human does. What if we could train a model to detect nearly imperceptible changes in color and shading? We were curious to test how "sharp" an object detection model's vision could get.

That's a wicked lake

It's easy to see what's going on here. We've changed the color in the middle of the lake to bright green, and it's not exactly camouflaged. Let's make the task harder.

Where is it

You probably didn't notice where the anomaly is. If you did, it probably took you a while.

I see it now

We took a random landscape photo and multiplied all the RGB values of the pixels inside this box by 1.2-- if you look carefully, you can see a few patches of neon. Let's find out if we train a model that can detect anomalies like this.

Data Preparation

We wrote a script that scraped around 200 photos and modified them all in subtle ways like in the photo above. To prepare this data, We created a folder with all the altered photos and a dataframe. Each row of the dataframe has a path to a specific photo as well as which part of the photo We altered and the ratio that increased the RGB values of the pixels.

The dataset we prepared looks like this:

dataset df

We were going to build models to leverage images and numeric features r and discolor_ratio to predict the coordinates of the center of the anomaly we created in the images, x and y.

Models Trained

We trained 5 CNN-style models to predict x and y. Refer to this notebook.

  1. CNN trained with only images data with a higher learning rate and fewer epochs
  2. CNN trained with only images data with a lower learning rate and more epochs
  3. CNN trained with images and numeric features combined before the fully connected layers
  4. CNN trained with images and numeric features combined before the last fully connected layers
  5. CNN trained images and numeric features passing through a linear layer first then combined before the last fully connected layers

The loss function those models trained was Mean Squared Error and the evaluation matrix used was the average distance between the predicted coordinates and the true coordinates x and y.

We wanted to examine if different training techniques or different ways of combining numeric features with image data were helpful or not.

Finding

finding

We can observe from the picture above that:

  1. Model 1 has the best performance in having the lowest average distance between the predicted coordinates and the true coordinates.
  2. All models' validation matrix tends to fall into a similar range.
  3. Some models are quicker to converge than others.

Based on the limited approaches we tried, we can conclude that different training techniques and combining numeric features with image data to train a CNN-style model for our task did not help in a meaningful way.

image-anomaly-detection-with-cnn's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.