Detect defects in semiconductor materials based on infrared microscope images. By default, a bounding box is put around the found defect together with a label and likeness score.
The program uses the YOLOv8 algorithm by Ultralytics.
A pre-annotated dataset for training is given in test_examples.zip
in the readily proper format for the YOLOv8 algorithm.
The corresponding training configuration file is training_config.yaml
.
A custom dataset can also be annotated and used following the instructions below.
By Anaconda:
- Create an environment
conda create -n defect_detection python=3.11.9
(PyTorch supports Python up to 3.11). - Activate the environment
conda activate defect_detection
. - Install PyTorch following the instructions at https://pytorch.org/get-started/locally/.
- Install Ultralytics by
conda install conda-forge::ultralytics
.
If you are using a system with GPU with CUDA, install PyTorch with the appropriate options.
There are many tools for annotating image data but a good choice is LabelImg. This software is assumed in the instructions below.
- Download LabelImg and install it following the instructions.
- Follow the Steps (YOLO) instructions on the LabelImg GitHub page to annotate your image.
- Split the images into a train and a validation set and put them into their respective folders.
- Write a configuration file for the set following the example in
training_config.yaml
.
- (Optional, if no custom dataset) Extract training data from
training_data.zip
. - Set the paths to point to the train data in
training_config.yaml
. - If using CPU for training, put
device=CPU
in the optionsmodel.train
in the notebooktrain_yolo.ipynb
. To use GPU putdevice=0
or e.g.device=[0,1]
if multiple GPUs are available. - Activate the environment
conda activate defect_detection
- Run the
train_yolo.ipynb
Jupyter notebook in the environment to train the model.
- Make an output folder for the labeled images.
- Activate the environment
conda activate defect_detection
. - Modify and run the Jupyter notebook
predict_yolo.ipynb
in the Anaconda environment to detect defects in images.