Data enhancement: Based on Yolov5/Yolov7/Yolov8---automatically generate pictures and xml files to solve problems such as difficult training of small samples

1. Data Augmentation

        Data augmentation (Data Augmentation) is a method that uses a small amount of data to generate more similarly generated data through prior knowledge to expand the training data set. Data augmentation methods are often used to solve small sample problems in real business.

 

        The main problem of small-sample learning is that the sample size is too small, which leads to insufficient sample diversity to describe the complete sample distribution. The sample diversity can be improved through sample enhancement; the method based on data enhancement is to use auxiliary data sets or auxiliary information to enhance the target data set. Perform data augmentation or feature enhancement to make the model fit better. Data augmentation can be unlabeled or synthetically labeled data; feature enhancement is to add features that are easy to classify in the feature space of the original sample and increase feature diversity;

2. Automatically generate pictures and xml files

2.1 Gamma change data enhancement

Adjust the degree of gamma change through the two changes of aa and gg

# -*- coding: utf-8 -*-
"""
Created on Fri Jun 01 15:24:21 2018

@author: AI&CV
"""

import cv2  
import numpy as np 
import xml.etree.ElementTree as ET
import os
from skimage import  exposure





xmlpath = './VOC2007/Annotations/'
imgpath = './VOC2007/JPEGImages/'
hist_imgpath = './VOC2007/gammma/'
hist_xmlpath = '

Guess you like

Origin blog.csdn.net/m0_63774211/article/details/130896875