/AIVA_2022_METAL

Flaw detection in metal surface images

Primary LanguagePython

Classification and localisation of defects in images of metal surfaces.

This project uses (re-training) of YOLOV5.

πŸ‘¨β€πŸŽ“ This project was carried out during my master's degree in computer vision at URJC - Madrid

AIVA_2022_METAL

Description

This repository contains the practice for the subject Industrial Applications in Machine Vision belonging to the Master's Degree in Machine Vision taught at the Universidad Rey Juan Carlos.

The aim of this work is the classification and detection of defects on metal surfaces in a production line. To do so, we will make an implementation in Python with an object detector (YOLOv5) and we will connect it via C to the application that is already running in the factory.

Dataset

The dataset provided by the company is composed of 200x200 grayscale images. For each category we have been provided with 300 images with their labels. The categories to be classified are the following:

  • Inclusions
  • Patches
  • Scratches

result

General outline

General outline

Documentation

The list of official project documentation delivered to the client is attached: (The documents are in spanish)

Requirements

  • Docker
  • Postman (http requests)

How to run the app

Using our docker image, we can install our entire repository and the dependencies we will need.

$ docker pull luisrosario04/aiva_2022_metal

Once the image is downloaded, we are going to launch the container (docker) with the following command:

$ docker run -p 8000:5000 luisrosario04/aiva_2022_metal

The server listens in localhost:8000

Documentation of http requests -> POSTMAN

Tests

Tests

When a push or pull is performed automatically:

  • When tests are launched the results can be found in the github actions.
  • The quality of the code is tested with flake8 and mypy.

There are 20 tests with a total, for a coverage of 96%.

Project structure

    .
    β”œβ”€β”€ dataset
    β”‚        β”œβ”€β”€ ANNOTATIONS
    β”‚        └── IMAGES
    β”œβ”€β”€ docs
    β”‚        β”œβ”€β”€ DiseΓ±o_grupoC.pdf
    β”‚        └── ERS_grupoC.pdf
    β”œβ”€β”€ docker
    β”‚        └── Dockerfile
    β”œβ”€β”€ exemples
    β”‚        β”œβ”€β”€ esquema.jpeg
    β”‚        β”œβ”€β”€ resultado.jpeg
    β”‚        β”œβ”€β”€ Screen1.png
    β”‚        └── tipos_defectos.png
    β”œβ”€β”€ pyproject.toml
    β”œβ”€β”€ README.md
    β”œβ”€β”€ requirements_dev.txt
    β”œβ”€β”€ requirements.txt
    β”œβ”€β”€ setup.cfg
    β”œβ”€β”€ setup.py
    β”œβ”€β”€ src
    β”‚   └── algorithm
    β”‚       └── main_algorithm.py
    β”‚   └── fast_rcnn
    β”‚       └── main_fast_rcnn.py
    β”‚   └── imperfection
    β”‚       └── main_imperfection.py
    β”‚   └── server
    β”‚       └── main_server.py
    β”‚   └── system_recognition
    β”‚       └── main_system_recognition.py
    β”‚   └── yolo_v5
    β”‚       └── main_yolo_v5.py
    β”œβ”€β”€ tests
    β”‚       └── test_algorithm.py
    β”œβ”€β”€ yolo_v5
    β”‚       β”œβ”€β”€ models
    β”‚       β”œβ”€β”€ utils
    β”‚       β”œβ”€β”€ weights
    β”‚       β”œβ”€β”€ detect.py
    β”‚       └── export.py
    └── tox.ini

Results

resultado

AUTORS

  • PΓ‰REZ GARCÍA DE LA PUENTE, NATALIA LOURDES - Member 1 - Natalia
  • GILABERT MAΓ‘O, VICENTE - Member 2 - Vicent
  • ROSARIO TREMOULET, LUIS - Member 3 - Luis