Soldering defects Detection
Overview
Using YOLOv8 for detect soldering defects. The soldering defects include: short, insufficient (not enough solder), balling (too much solder).
Then, use some techniques and mathematical formulas to determine the front position of the object (flip detection).
Install requirements
Install ecos_core: Clone project repository
pip install -r requirements.txt
pip install -e .
Training
Prepare dataset structure
# your dataset structure should be like this
data/
-images/
-train/
-*.jpg
-val/
-*.jpg
-test/
-*.jpg
-labels/
-train/
-*.txt
-val/
-*.txt
-test/
-*.txt
-data.yaml
Note
Image extensions can be replaced with .jpeg, .png,...
data.yaml
determines where the image is, how many classes, classnames it has, example:
nc: 3
names: ["short", "insufficient", "solder_balling"]
train: <path-to-train-images-folder>
val: <path-to-val-images-folder>
test: <path-to-test-images-folder>
Modify Options
In options file (opt.json
) please set value of key data
is path to the data.yaml
file.
You can modify imagesz
, batch_size
, epochs
for train settings.
Training command
To train, please follow the command below:
python train.py --opt <PATH_TO_OPT_FILE> --weight-path <PATH-TO-MODEL-FILE>
With:
PATH_TO_OPT_FILE
: is path to file opt.jsonPATH-TO-MODEL-FILE
: is path to model, maybe a pretrained weight (yolov8s.pt) or yaml define model configuration. If you want to usingimagesz
:1280, this path should be path to file yolov8-P6.yaml for better performance.
Example:
python train.py --opt opt.json --weight-path yolov8-p6.yaml
Testing
To validate on test set, please follow the command below:
python test.py --opt <PATH_TO_OPT_FILE> --weight-path <PATH_TO_WEIGHT_FILE>
Or, you can predict specific images folder by command:
python predict.py --opt "<PATH_TO_OPT_FILE>" --weight-path <PATH_TO_WEIGHT_FILE> --input-path "<PATH_TO_TEST_FOLDER>"
With:
PATH_TO_OPT_FILE
is path to file opt.jsonPATH_TO_WEIGHT_FILE
is path to weight file after trainingPATH_TO_TEST_FOLDER
is path to test folder