Research Article

A Garbage Detection and Classification Method Based on Visual Scene Understanding in the Home Environment

Algorithm 1

Model training algorithm.
Input: Self-made object image data set and markup files
Initialization parameters: epoch, learning rate, batch size, input size, network model configuration yaml file, IOU, yolov5m.pt pre-training weights
Image preprocessing: image brightness, image contrast, image saturation, Mosaic
(1)Prepare data, make data set, and divide training set and validation set.
(2)Load data configuration information and initialization parameters, input data, and preprocess it.
(3)Load the network model, and perform feature extraction and object positioning and classification on the input image.
(4)As the number of epochs increases, use SGD to update and optimize each set of parameters in the network.
(5)If the current epoch is not the last round, the MAP of the current model is calculated in the validation set. If the calculated model performance is better, the best model is updated and stored.
(6)After training the set number of epochs, obtain the trained optimal performance model and the most recently trained model.
Output: The best-performing detection model in this training.