Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Data Augmentation (Data Amplification)

Updated on 2023-09-06 GMT+08:00

Overview of Data Amplification Operators

Data amplification is mainly used in scenarios where the training dataset is insufficient or simulation is required. You can transform the labeled dataset to increase the number of images trained and generate corresponding labels. In the deep learning field, augmentation is of great significance. It can improve model generalization and enhance anti-disturbance. Original data is not changed during data amplification. The newly amplified image or XML file is saved in the specified output path.

ModelArts provides the following data amplification operators:

Table 1 Description of data amplification operators

Operator

Description

Advanced

AddNoise

Adds noises to simulate the noises that may be generated when common capture devices capture images.

  • noise_type: noise distribution type. Gauss indicates Gaussian noise. Laplace indicates Laplace noise. Poisson indicates Poisson noise. Impulse indicates impulse noise. SaltAndPepper indicates salt and pepper noise. The default value is Gauss.
  • loc: average noise distribution. This parameter is valid only in Gauss and Laplace. The default value is 0.
  • scale: standard deviation of noise distribution. This parameter is valid only in Gauss and Laplace. The default value is 1.
  • lam: lambda coefficient of Poisson distribution. This parameter is valid only for Poisson. The default value is 2.
  • p: probability of pulse noise or salt-and-pepper noise for each pixel. This parameter is valid only for Impulse and SaltAndPepper. The default value is 0.01.
  • do_validation: indicates whether to validate data before data amplification. The default value is True.

Blur

Uses filters to filter images and sometimes to simulate imaging of imaging devices.

  • blur_type: The value can be Gauss or Average, which indicates Gaussian filtering and average filtering, respectively. The default value is Gauss.
  • do_validation: indicates whether to validate data before data amplification. The default value is True.

Crop

Randomly crops a part of an image as a new image.

  • crop_percent_min: minimum value in the value range of the cropping ratio of each edge. The default value is 0.0.
  • crop_percent_max: maximum value in the value range of the cropping ratio of each edge. The default value is 0.2.
  • do_validation: indicates whether to validate data before data amplification. The default value is True.

CutOut

Random erase, which is a common method used in deep learning to simulate an object that is blocked by an obstacle.

do_validation: indicates whether to validate data before data amplification. The default value is True.

Flip

Flips along the horizontal or vertical axis of an image, which is a very common enhancement method.

  • lr_ud: flipping direction. lr indicates horizontal flipping, and ud indicates vertical flipping. The default value is lr.
  • flip_p: flipping probability. The default value is 1.
  • do_validation: indicates whether to validate data before data amplification. The default value is True.

Grayscale

Changes a three-channel color image to a three-channel grayscale image.

do_validation: indicates whether to validate data before data amplification. The default value is True.

HistogramEqual

Indicates the histogram equalization, which is mainly used to improve the visual effect of images. It is used in some scenarios.

do_validation: indicates whether to validate data before data amplification. The default value is True.

LightArithmetic

Implements linear enhancement on luminance space.

do_validation: indicates whether to validate data before data amplification. The default value is True.

LightContrast

Enhances luminance contrast. A certain non-linear function is used to change the luminance value of the luminance space.

func: The default value is gamma.

  • gamma: Gamma correction. Its formula is 255*((v/255)**gamma)').
  • sigmoid: S-shaped curve function. Its formula is 255*1/(1+exp(gain*(cutoff-I_ij/255)))').
  • log: logarithmic function. Its formula is 255*gain*log_2(1+v/255).
  • linear: linear function. Its formula is 127 + alpha*(v-127)').

do_validation: indicates whether to validate data before data amplification. The default value is True.

MotionBlur

Indicates the motion blur generated when an object moves.

do_validation: indicates whether to validate data before data amplification. The default value is True.

Padding

Pads an image with black edges.

  • px_top: number of pixel lines added at the top of the image. The default value is 1.
  • px_right: number of pixel lines added at the right of the image. The default value is 1.
  • px_left: number of pixel lines added at the left of the image. The default value is 1.
  • px_bottom: number of pixel lines added at the bottom of the image. The default value is 1.
  • do_validation: indicates whether to validate data before data amplification. The default value is True.

Resize

Resizes an image.

  • height: height of the image after conversion. The default value is 224.
  • width: width of the image after conversion. The default value is 224.
  • do_validation: indicates whether to validate data before data amplification. The default value is True.

Rotate

Rotates an image around the center point. After the operation is complete, the original shape of the image remains unchanged, and the blank part is filled with black.

  • angle_min: minimum value in the range of rotation angles. Each image randomly obtains a value from the range. The default value is 90°.
  • angle_max: maximum value in the range of rotation angles. Each image randomly obtains a value from the range. The default value is -90°.
  • do_validation: indicates whether to validate data before data amplification. The default value is True.

Saturation

Enhances chrominance and saturation. The H and S spaces in the HSV of an image are changed linearly to change the chrominance and saturation of the image.

do_validation: indicates whether to validate data before data amplification. The default value is True.

Scale

Zooms in or out an image. The length or width of an image is randomly zoomed in or out.

  • scaleXY: scaling direction. X indicates horizontal, and Y indicates vertical. The default value is X.
  • scale_min: lower limit of the random scaling ratio range. The default value is 0.5.
  • scale_min: upper limit of the random scaling ratio range. The default value is 1.5.
  • do_validation: indicates whether to validate data before data amplification. The default value is True.

Sharpen

Indicates image sharpening, which is used to sharpen the edges of objects.

do_validation: indicates whether to validate data before data amplification. The default value is True.

Shear

Indicates image shearing, which is used for geometric transformation of images. Pixels are mapped using linear functions.

  • shearXY: shearing direction. X indicates horizontal, and Y indicates vertical. The default value is X.
  • shear_min: lower limit of the random shearing angle range. The default value is -30.
  • shear_max: upper limit of the random shearing angle range. The default value is 30.
  • do_validation: indicates whether to validate data before data amplification. The default value is True.

Translate

Moves an image along the x-axis or y-axis, discards the part that exceeds the original image, and fills the blank part with black.

  • translateXY: translation direction. X indicates horizontal, and Y indicates vertical. The default value is X.
  • do_validation: indicates whether to validate data before data amplification. The default value is True.

Weather

Adds weather information to simulate the weather effect.

weather_mode: weather mode. The default value is Rain.

  • Rain: rain
  • Fog: fog
  • Snow: snow
  • Clouds: cloud

do_validation: indicates whether to validate data before data amplification. The default value is True.

Operator Input Requirements

The following two types of operator input are available:

  • Datasets: Select a dataset and its version created on the ModelArts console from the drop-down list. Ensure that the dataset type be the same as the scenario type selected in this task.
  • OBS Catalog: The storage structure supports Images and labels.

    Images and labels: The structure varies depending on the scenario type.

    The following shows the directory structure in the image classification scenario. The following directory structure supports only single-label scenarios.

    input_path/
        --label1/
            ----1.jpg
        --label2/
            ----2.jpg
        --../

    The following shows the directory structure in the object detection scenario. Images in JPG, JPEG, PNG, and BMP formats are supported. XML files are standard PACAL VOC files.

    input_path/
        --1.jpg
        --1.xml
        --2.jpg
        --2.xml
        ...

Output Description

Some data will be discarded due to some operations of the operators. Therefore, the output folder may not contain the full dataset. For example, Rotate will discard the images whose bounding boxes exceed the image boundaries.

The following shows the output directory structure. In this structure, the Data folder stores newly generated images and labeling information. The manifest file stores the structure of images in the folder and can be directly imported to the dataset in Data Management.

|----data_url
    |----Data
        |----xxx.jpg
        |----xxx.xml(xxx.txt)
    |----output.manifest

A manifest file example is as follows:

{
	"id": "xss",
	"source": "obs://home/fc8e2688015d4a1784dcbda44d840307_14.jpg",
	"usage": "train", 
	"annotation": [
		{
			"name": "Cat", 
			"type": "modelarts/image_classification"
		}
	]
}

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback