Use CSPResNeXt50 for image classification. An example is to use steel plate defect classification. You can use this APP to train your images for image classification.
[Operation steps and instructions]
Open the APP, please refer to the LEADERG-APP operating instructions.
APP has four main functions: data preparation, training, inference, and others.
Data preparation :
1. Select the data set for AI learning.
If you want to train your image, please click browse to open the file location. It is recommended to copy a default data folder and change it to your own data name.
Then find the train, val, and test folders, delete the old images in the folders and replace them with images that you need to train, infer, and test.
1) The file name of the image needs to comply with the requirements: The file name of the image must be prefixed with [category name-], for example: inclusion in inclusion-1.jpg is the category name of the image.
2) The image is recommended as a square. If it is not a square, you can use zoom or crop, etc.
3) The image file and its attached file name must be .jpg or .png or .jpeg.
2. Set the number of categories and category names.
- Set the number of categories, click [Classes num] to open the text file, find classes = 4, the number 4 is the number of categories of your data. For example: the training image has 5 categories => classes = 5.
- Set the category name, click [Classes name] to open the text file, and set the training category name.
- Set the path. Please change the data/plate in train, valid, labels, backup to the data/folder name. For example, in the next step to establish their own sample data and name is pcb, this step needs to be set
- train = data/plate/train.txt => train = data/pcb/train.txt
- valid = data/plate/valid.txt => valid = data/pcb/valid.txt
- labels = data/plate/label.names => labels = data/pcb/label.names
- backup = data/plate/model => backup = data/pcb/model
- cfg configuration file. Click [99. edit CSPNet.cfg] and find [avgpool]. Below this you can find filters=4. The number 4 is the number of categories of your data. For example: the training images have 5 categories => filters=5.
3. Click [1. prepare train txt] and [2. prepare val txt] to automatically generate a list of images for training and verification.
If you are not training for the first time and you have already trained a model, to continue training, please copy model/csresnext50-omega_best.weights and name it pretrain.weights to overwrite the original pretrain.weights.
If your device supports NVIDIA GPU accelerated computing, please click [3. train (GPU)]; if NVIDIA GPU accelerated computing is not supported, please click [3. train (CPU)].
The app provides inferences for a single image or all images in a folder.
Please choose a model with better training effect or directly choose csresnext50-omega_final.weights. If csresnext50-omega_final.weights is not produced yet, but you think the model has converged, you can also choose csresnext50-omega_last.weights.
Then rename the selected model to csresnext50-omega_best.weights to overwrite the original model.
(The model is placed in the model folder and the extension is .weights)
1. Inferring a single image : If your device supports NVIDIA GPU accelerated computing, please click [4. inference (GPU)]; if NVIDIA GPU accelerated computing is not supported, please click [4. inference (CPU)].
Then please select an image you want to infer, press [Open] to infer and display the result.
2. Inference folder: If your device supports NVIDIA GPU accelerated computing, please click [5. inference_folder (GPU)]; if NVIDIA GPU accelerated computing is not supported, please click [5. inference_folder (CPU)].
Then please select the folder you want to infer, press [Open] to infer and display the result.
Please press any key on the keyboard to switch to the next image on the displayed result image.
1. Click [99. edit CSPNet.cfg] to open the text file of the CSPNet network structure.
2. Click [99. browse data] to open the data folder.
After downloading this software, please use 7zip to unzip it. If you would like to try it, please type "TRY30" to activate it. The 30 days trial is only one time for one computer.