Home Technology peripherals AI Seven Steps to Prepare Datasets for Image AI Projects

Seven Steps to Prepare Datasets for Image AI Projects

Sep 26, 2023 pm 11:45 PM
AI data set

Translator| ##I wonder if you have noticed that the data set may be the most overlooked part of the machine learning project. To most people, a dataset is nothing more than a collection of pre-made images that have been quickly put together or downloaded. In fact, datasets are the cornerstone of any image-based artificial intelligence (AI) project. For any machine learning project aiming to achieve high accuracy, creating and managing a balanced and well-structured dataset is crucial.

# However, creating a dataset is not as simple as collecting hundreds of images. When we try to start an AI project, we are likely to encounter various hidden dangers. Below, I'll discuss seven typical steps you can take to create your own dataset so you can gain insight into the importance of dataset size, possible data omissions, and converting a dataset into a database.

#Note: These steps will mainly apply to object detection and classification projects that include image datasets. Other project types, such as NLP

or graphics projects, require a different approach.

Steps

1: Image size

Normally, neural networks can only process images of a specific size, and images exceeding a threshold will be forced to be reduced. This means that before using the dataset, we need to choose a suitable neural network and resize the image accordingly

As you know, if the image Reducing the size may lead to a significant decrease in accuracy or even the disappearance of small objects on the image, thus causing damage to the entire recognition process. As shown below, you need to detect the license plate number in the image captured by the security camera, and the license plate only accounts for a small part of the entire image. Therefore, when the neural network shrinks the image, the license plate number may become too small to be recognized

As shown in the figure below, if you can understand the image sizes that the network can use, it will help you to crop the appropriate data set images.

##Although the image size that most neural networks can handle is relatively small, such as Seven Steps to Prepare Datasets for Image AI Projects

Yolo The latest neural networks such as v5x6

are capable of processing larger resolution images. For example, Yolo v5x

s

Seven Steps to Prepare Datasets for Image AI Projects6

can handle images up to 1280 pixels wide image. Step 2: Understandyourenvironment

In order to ensure that the data set can accurately reflect the real images that the neural network needs to recognize during operation, we need to pay attention to the following factors when collecting the data set: Type of camera, smartphone camera or security camera

Image The size

  1. The location of the camera, whether it is indoors or outdoors
  2. Weather conditions , such as light, rain, fog, snow, etc.
  3. With a clear understanding of the real images the neural network is processing, we can create a data set that accurately reflects those of interest. objects, and their environment.
  4. Collecting common images from Google might be considered the easiest and fastest way to assemble a large dataset. However, this method is actually difficult to achieve high accuracy requirements. As shown below, images from Google or photo databases are often "beautified" compared to images captured by real cameras

A data set that is too "beautiful" is likely to lead to higher test accuracy. This means that the neural network will only perform well on test data (a collection of images purified from the dataset), but will perform poorly in real-world conditions and result in poor accuracy.

Step

3

Seven Steps to Prepare Datasets for Image AI Projects:

Format and Comments

Another important aspect we need to pay attention to is: the format of the image. Before starting your project, check which formats your chosen framework supports and whether your images can meet these requirements. Although the current framework can support multiple image formats, there are still problems with formats such as .jfif.

Annotation data can be used to specify bounding boxes, file names, and the different structures that can be used. Generally, different neural networks and frameworks require different annotation methods. Some require absolute coordinates containing the bounding box location, others require relative coordinates; some require each image to be accompanied by a separate annotated .txt file, while others require Some require only one file containing all comments. As you can see, even if your dataset has good images, it won't help if your framework can't handle the annotations.

Step 4: Training and validation subsets

For training purposes, the data set is usually divided into two subsets:

  1. Training subset- It is a set of images. The neural network will be trained on this set of images. Its proportion is 70% to 80% of the total number of images.
  2. Validation subset- are smaller images used to check how well the neural network learns during training set. Its proportion is between 20% and 30% of the total number of images.

Seven Steps to Prepare Datasets for Image AI Projects

Typically, a neural network will use object features extracted from a training subset to "learn" The appearance of an object. That is, after a training period (epoch), the neural network looks at the validation subset data and tries to guess what it can "Look " to those objects. Whether it is a correct or wrong guess, its structure allows the neural network to learn further.

While this method has been widely used and proven to achieve good results, we prefer to adopt a different approach that combines the data The set is divided into the following subsets:

  1. Training subset - accounts for ## of the total number of images # 70%
  2. Validation subset - Accounting for the total number of images 20%
  3. Test data set - Approx. 10%

Seven Steps to Prepare Datasets for Image AI Projects

## of the total number of images due to test sub The set contains images from the dataset that the neural network has never seen, so developers can test the model on this subset to see how well it performs when run manually and which images it has difficulty with. In other words, this subset will help identify where the neural network may make mistakes before the project starts, thereby avoiding excessive retraining after the project starts.

Step

5: Datamissing

If you use If the data used to train a machine learning algorithm contains exactly the information you are trying to predict, a data breach may occur. As shown in the figure below, from an image recognition perspective, data leakage occurs when photos of the same object in the training and validation subsets are very similar. Obviously, missing data is extremely detrimental to the quality of neural networks.

Seven Steps to Prepare Datasets for Image AI Projects##Essentially, after the model sees an image in the training data set, it first extracts its features, Then go into the validation dataset and find the exact same (or very similar) images you saw. Therefore, rather than saying that the model is actually learning, it is better to say that it is just memorizing various information. Sometimes this results in ridiculously high accuracy on the validation dataset (e.g., as high as

98%), but very low accuracy in production. One of the most commonly used data set segmentation methods is to randomly shuffle the data and then select the top

70% images are put into the training subset, and the remaining 30% are put into the validation subset. This method can easily lead to data omissions. As shown in the figure below, our immediate priority is to remove all "duplicate" photos from the dataset and check whether similar photos exist in both subsets.

For this, we can use a simple script to automatically perform duplicate deletion. Of course, you can adjust the duplication threshold, for example: only delete completely duplicate pictures, or pictures with a similarity as high as 90% , etc. In general, the more duplicate content is removed, the more accurate the neural network will produce.

Step 6: Large Data Set Database

If your data set is quite large, for example: more than 10million images, and has dozens For object classes and subclasses, we recommend that you create a simple database to store data set information. The reason behind this is actually very simple: with large data sets, it is difficult to keep track of all the data. Therefore, without some structured processing of the data, we will not be able to analyze it accurately.

Through the database, you can quickly diagnose the data set and find out that: too few pictures in a specific category will make it difficult for the neural network to recognize the object; The distribution of images between categories is not even enough; there are too many Google images in a specific category, resulting in a low accuracy score for that category, etc.

With a simple database, we can include the following information:

  1. ## File name
  2. File path
  3. Comment data
  4. Class data
  5. Data source (from production environment, Google, etc.)
  6. Object type, name and other object-related information

The database is indispensable for collecting data sets and statistical data Tool of. It helps us quickly and easily see how balanced the dataset is and how many high-quality images are in each category (from a neural network perspective). With data like the one visualized below, we can analyze it faster and compare it to the recognition results to find the root cause of poor accuracy

Seven Steps to Prepare Datasets for Image AI Projects

What needs to be re-written is: One issue worth noting is that the reason for the low accuracy may be due to a smaller number of images or a higher proportion of Google Photos in a certain category. By creating such a database, the time for production, testing and model retraining can be greatly reduced

Step 7 :Dataset Augmentation

As a technique used to increase the number of images, data augmentation is the simple or complex transformation of the data Processes, such as through flipping or style transformation, we can improve the validity of the data. The effective data set obtained based on this does not require excessive training. As shown in the image below, such data transformations can be as simple as simply rotating the image by 90 degrees, or as complex as adding solar flares to the image to simulate a backlit photo or lens Flare.

Seven Steps to Prepare Datasets for Image AI Projects

Typically, these enhanced conversions are automated. For example, we can prepare a Python library specifically for data augmentation. Currently, there are two types of data augmentation:

  1. Pre-training augmentation- At the beginning of the training process Previously, the data was augmented and added to the training subset. Of course, we can make such additions only after the data set has been divided into training and validation subsets to avoid the data omissions mentioned earlier.
  2. In-training enhancement- Use something similar to PyTorch The frame has built-in image transformation technology.

It is worth noting that increasing the size of the data set ten times does not make the neural network ten times more efficient. In fact, this may actually make the network perform worse than before. Therefore, we should only use enhancements that are relevant to production environments. For example, a camera installed in a building will not be exposed to rain when it is operating normally. So there is absolutely no need to add "rain" enhancement to the image.

knot

Although for those looking to apply AI to business, the dataset is The least exciting part. But it is undeniable that data sets are an important part of any image recognition project. Moreover, in most image recognition projects, the management and organization of data sets often takes a lot of time from the team. Finally, let’s summarize how you can get the best results from your AI projects by properly handling your datasets:

  1. Crop or adjust The size of the image to meet the requirements of the neural network
  2. #Collect real images based on weather and lighting conditions
  3. Construct annotations according to the requirements of the neural network
  4. Avoid using all images to train the network. A part needs to be reserved for testing
  5. Delete duplicate images in the validation data set to avoid data omission
  6. Create a database to quickly diagnose the data set
  7. Use data augmentation as little as possible to increase the number of images

Translator introduction

Julian Chen, 51CTO community editor, has more than ten years of IT experience Project implementation experience, good at managing and controlling internal and external resources and risks, and focusing on disseminating network and information security knowledge and experience.

Original title: 7 Steps To Prepare A Dataset For An Image-Based AI Project by Oleg Kokorin

The above is the detailed content of Seven Steps to Prepare Datasets for Image AI Projects. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Bytedance Cutting launches SVIP super membership: 499 yuan for continuous annual subscription, providing a variety of AI functions Bytedance Cutting launches SVIP super membership: 499 yuan for continuous annual subscription, providing a variety of AI functions Jun 28, 2024 am 03:51 AM

This site reported on June 27 that Jianying is a video editing software developed by FaceMeng Technology, a subsidiary of ByteDance. It relies on the Douyin platform and basically produces short video content for users of the platform. It is compatible with iOS, Android, and Windows. , MacOS and other operating systems. Jianying officially announced the upgrade of its membership system and launched a new SVIP, which includes a variety of AI black technologies, such as intelligent translation, intelligent highlighting, intelligent packaging, digital human synthesis, etc. In terms of price, the monthly fee for clipping SVIP is 79 yuan, the annual fee is 599 yuan (note on this site: equivalent to 49.9 yuan per month), the continuous monthly subscription is 59 yuan per month, and the continuous annual subscription is 499 yuan per year (equivalent to 41.6 yuan per month) . In addition, the cut official also stated that in order to improve the user experience, those who have subscribed to the original VIP

Context-augmented AI coding assistant using Rag and Sem-Rag Context-augmented AI coding assistant using Rag and Sem-Rag Jun 10, 2024 am 11:08 AM

Improve developer productivity, efficiency, and accuracy by incorporating retrieval-enhanced generation and semantic memory into AI coding assistants. Translated from EnhancingAICodingAssistantswithContextUsingRAGandSEM-RAG, author JanakiramMSV. While basic AI programming assistants are naturally helpful, they often fail to provide the most relevant and correct code suggestions because they rely on a general understanding of the software language and the most common patterns of writing software. The code generated by these coding assistants is suitable for solving the problems they are responsible for solving, but often does not conform to the coding standards, conventions and styles of the individual teams. This often results in suggestions that need to be modified or refined in order for the code to be accepted into the application

Seven Cool GenAI & LLM Technical Interview Questions Seven Cool GenAI & LLM Technical Interview Questions Jun 07, 2024 am 10:06 AM

To learn more about AIGC, please visit: 51CTOAI.x Community https://www.51cto.com/aigc/Translator|Jingyan Reviewer|Chonglou is different from the traditional question bank that can be seen everywhere on the Internet. These questions It requires thinking outside the box. Large Language Models (LLMs) are increasingly important in the fields of data science, generative artificial intelligence (GenAI), and artificial intelligence. These complex algorithms enhance human skills and drive efficiency and innovation in many industries, becoming the key for companies to remain competitive. LLM has a wide range of applications. It can be used in fields such as natural language processing, text generation, speech recognition and recommendation systems. By learning from large amounts of data, LLM is able to generate text

Can fine-tuning really allow LLM to learn new things: introducing new knowledge may make the model produce more hallucinations Can fine-tuning really allow LLM to learn new things: introducing new knowledge may make the model produce more hallucinations Jun 11, 2024 pm 03:57 PM

Large Language Models (LLMs) are trained on huge text databases, where they acquire large amounts of real-world knowledge. This knowledge is embedded into their parameters and can then be used when needed. The knowledge of these models is "reified" at the end of training. At the end of pre-training, the model actually stops learning. Align or fine-tune the model to learn how to leverage this knowledge and respond more naturally to user questions. But sometimes model knowledge is not enough, and although the model can access external content through RAG, it is considered beneficial to adapt the model to new domains through fine-tuning. This fine-tuning is performed using input from human annotators or other LLM creations, where the model encounters additional real-world knowledge and integrates it

Five schools of machine learning you don't know about Five schools of machine learning you don't know about Jun 05, 2024 pm 08:51 PM

Machine learning is an important branch of artificial intelligence that gives computers the ability to learn from data and improve their capabilities without being explicitly programmed. Machine learning has a wide range of applications in various fields, from image recognition and natural language processing to recommendation systems and fraud detection, and it is changing the way we live. There are many different methods and theories in the field of machine learning, among which the five most influential methods are called the "Five Schools of Machine Learning". The five major schools are the symbolic school, the connectionist school, the evolutionary school, the Bayesian school and the analogy school. 1. Symbolism, also known as symbolism, emphasizes the use of symbols for logical reasoning and expression of knowledge. This school of thought believes that learning is a process of reverse deduction, through existing

To provide a new scientific and complex question answering benchmark and evaluation system for large models, UNSW, Argonne, University of Chicago and other institutions jointly launched the SciQAG framework To provide a new scientific and complex question answering benchmark and evaluation system for large models, UNSW, Argonne, University of Chicago and other institutions jointly launched the SciQAG framework Jul 25, 2024 am 06:42 AM

Editor |ScienceAI Question Answering (QA) data set plays a vital role in promoting natural language processing (NLP) research. High-quality QA data sets can not only be used to fine-tune models, but also effectively evaluate the capabilities of large language models (LLM), especially the ability to understand and reason about scientific knowledge. Although there are currently many scientific QA data sets covering medicine, chemistry, biology and other fields, these data sets still have some shortcomings. First, the data form is relatively simple, most of which are multiple-choice questions. They are easy to evaluate, but limit the model's answer selection range and cannot fully test the model's ability to answer scientific questions. In contrast, open-ended Q&A

SK Hynix will display new AI-related products on August 6: 12-layer HBM3E, 321-high NAND, etc. SK Hynix will display new AI-related products on August 6: 12-layer HBM3E, 321-high NAND, etc. Aug 01, 2024 pm 09:40 PM

According to news from this site on August 1, SK Hynix released a blog post today (August 1), announcing that it will attend the Global Semiconductor Memory Summit FMS2024 to be held in Santa Clara, California, USA from August 6 to 8, showcasing many new technologies. generation product. Introduction to the Future Memory and Storage Summit (FutureMemoryandStorage), formerly the Flash Memory Summit (FlashMemorySummit) mainly for NAND suppliers, in the context of increasing attention to artificial intelligence technology, this year was renamed the Future Memory and Storage Summit (FutureMemoryandStorage) to invite DRAM and storage vendors and many more players. New product SK hynix launched last year

SOTA performance, Xiamen multi-modal protein-ligand affinity prediction AI method, combines molecular surface information for the first time SOTA performance, Xiamen multi-modal protein-ligand affinity prediction AI method, combines molecular surface information for the first time Jul 17, 2024 pm 06:37 PM

Editor | KX In the field of drug research and development, accurately and effectively predicting the binding affinity of proteins and ligands is crucial for drug screening and optimization. However, current studies do not take into account the important role of molecular surface information in protein-ligand interactions. Based on this, researchers from Xiamen University proposed a novel multi-modal feature extraction (MFE) framework, which for the first time combines information on protein surface, 3D structure and sequence, and uses a cross-attention mechanism to compare different modalities. feature alignment. Experimental results demonstrate that this method achieves state-of-the-art performance in predicting protein-ligand binding affinities. Furthermore, ablation studies demonstrate the effectiveness and necessity of protein surface information and multimodal feature alignment within this framework. Related research begins with "S

See all articles