In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail the example analysis of data enhancement in SpringBoot. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
Data enhancement (Date Augmentation)
Increasing the size of data set is the most important way to solve the problem of over-fitting. However, the collection of sample data and tagging is often expensive, in the limited data set, the number of training samples can be increased through data enhancement technology, and the performance can be improved to some extent.
* * data enhancement (Data Augmentation) * * means that under the condition of keeping the sample label unchanged, the characteristics of the sample are changed according to the prior knowledge, so that the newly generated sample is also consistent with or approximately consistent with the true distribution of the data.
Common data enhancement methods: rotate, zoom, pan, crop, change the perspective, obscure a local area, so that the category label of the picture will not be changed.
Implementation of basic data enhancement
TensorFlow provides functions for handling common images, which are located in the tf.image sub-module.
1. Scalin
The zoom function of the picture can be realized through the tf.image.resize function.
# Zoom the input picture x to 22424x = tf.image.resize (x, [224,224])
two。 Rotation
The picture can be rotated by k 90 degrees counterclockwise through tf.image.rot90 (x, KPI 1).
# Picture rotated 180 degrees counterclockwise x = tf.image.rot90 (x, 2)
3. Flip
Random flipping of pictures in horizontal and vertical directions can be realized through tf.image.random_flip_left_right and tf.image.random_flip_up_down.
# horizontal flip (left and right upside down, mirror image) x = tf.image.random_flip_left_right (x) # Vertical flip (upside down) x = tf.image.random_flip_up_down (x)
4. Cut out
By removing some edge pixels in the left and right or up and down directions of the original image, the main body of the image can be kept unchanged and new image samples can be obtained at the same time.
In actual clipping, the image is generally scaled to a size slightly larger than the input size of the network, and then cut to the appropriate size. For example, if the input size of the network is 224x224, we first scale the image to the size of 244x244 through the resize function, and then randomly cut it to the size of 224x224.
# the picture is scaled to a slight size x = tf.image.resize (x, [224jue 224]) # and then randomly cropped to the appropriate size x = tf.image.random_crop (x, [224jue 224p3])
5. Other methods, such as adding noise, changing angle of view, random occlusion and so on.
The following figure shows the effects of the above different data enhancement methods:
Generate data
In addition, the labeled sample data can be generated by conditional generation countermeasure network (Conditional GAN, CGAN).
Through the generation model, we can learn the distribution of the data from the original data, so as to generate new samples, which can also improve the network performance to a certain extent.
This is the end of this article on "sample Analysis of data Enhancement in SpringBoot". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.