[go: up one dir, main page]

TWI734186B - Training image generating method and electronic device - Google Patents

Training image generating method and electronic device Download PDF

Info

Publication number
TWI734186B
TWI734186B TW108131658A TW108131658A TWI734186B TW I734186 B TWI734186 B TW I734186B TW 108131658 A TW108131658 A TW 108131658A TW 108131658 A TW108131658 A TW 108131658A TW I734186 B TWI734186 B TW I734186B
Authority
TW
Taiwan
Prior art keywords
image
specific object
processor
training
mask matrix
Prior art date
Application number
TW108131658A
Other languages
Chinese (zh)
Other versions
TW202111595A (en
Inventor
吳婷
李蛟
Original Assignee
威盛電子股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 威盛電子股份有限公司 filed Critical 威盛電子股份有限公司
Publication of TW202111595A publication Critical patent/TW202111595A/en
Application granted granted Critical
Publication of TWI734186B publication Critical patent/TWI734186B/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/50Context or environment of the image
    • G06V20/56Context or environment of the image exterior to a vehicle by using sensors mounted on the vehicle
    • G06V20/58Recognition of moving objects or obstacles, e.g. vehicles or pedestrians; Recognition of traffic objects, e.g. traffic signs, traffic lights or roads
    • G06V20/582Recognition of moving objects or obstacles, e.g. vehicles or pedestrians; Recognition of traffic objects, e.g. traffic signs, traffic lights or roads of traffic signs

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Physics & Mathematics (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • General Engineering & Computer Science (AREA)
  • Artificial Intelligence (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Multimedia (AREA)
  • Image Analysis (AREA)
  • Image Processing (AREA)

Abstract

A training image generation method and an electronic device are provided. The method includes: obtaining a first image including a specific object; removing a portion of the first image that does not belong to the specific object to obtain a second image; determining a first location in a target image; applying the specific object in the second image to the target image to generate a training image according to the first location; and training a model by using the training image.

Description

訓練影像產生方法與電子裝置Training image generation method and electronic device

本發明是有關於一種訓練影像產生方法與電子裝置。The invention relates to a training image generation method and electronic device.

先進駕駛輔助系統(Advanced Driver Assistant System,ADAS),是利用安裝於車上的各式各樣的感測器(例如,可偵測光、熱、壓力等變數),在第一時間收集車內外的環境資料,進行靜、動態物體的辨識、偵測與追蹤等技術上的處理,從而能夠讓駕駛者在最快的時間察覺可能發生的危險,以引起駕駛者的注意和提高安全性的主動安全技術。The Advanced Driver Assistant System (ADAS) uses a variety of sensors installed in the car (for example, it can detect variables such as light, heat, and pressure) to collect the inside and outside of the car at the first time The environmental data is processed by the identification, detection and tracking of static and dynamic objects, so that the driver can be aware of possible dangers in the fastest time, so as to attract the attention of the driver and improve the safety of the initiative safety technology.

ADAS 採用的感測器主要有攝像頭、雷達、雷射和超聲波等,可以探測光、熱、壓力或其它用於監測汽車狀態的變量。前述的感測器通常位於車輛的前後保險桿、後照鏡、駕駛桿內部或者擋風玻璃上。其中,攝像頭可以獲取車輛周圍場景影像,所獲得的影像通常可以用來進行目標檢測。例如,檢測前方車輛、行人、交通標誌等等物體。目前來說,常會結合深度學習演算法、機器學習演算法或卷積神經網路等技術來進行目標物的檢測。The sensors used in ADAS are mainly cameras, radars, lasers and ultrasonics, etc., which can detect light, heat, pressure or other variables used to monitor the state of the car. The aforementioned sensors are usually located on the front and rear bumpers, rear mirrors, inside the steering column or on the windshield of the vehicle. Among them, the camera can obtain the image of the scene around the vehicle, and the obtained image can usually be used for target detection. For example, detecting objects such as vehicles, pedestrians, traffic signs and so on ahead. Currently, technologies such as deep learning algorithms, machine learning algorithms, or convolutional neural networks are often used to detect targets.

而在利用卷積神經網路進行目標檢測時,通常需要大量的訓練影像來進行訓練,但是通過攝像頭採集到的資料(即實際路況的資料)中交通標誌的數目遠遠小於車輛或者行人的資料。這是由於在馬路上,交通標誌的個數本身相對於車輛或行人等物體就比較少,這就引起了資料不平衡問題。當遇到資料不平衡時,以總體分類準確率爲學習目標的傳統分類演算法會過多地關注多數類的物體,從而使得針對少數類的物體的分類的性能下降。When using convolutional neural networks for target detection, a large number of training images are usually needed for training, but the number of traffic signs in the data collected by the camera (ie, the data of actual road conditions) is much smaller than that of vehicles or pedestrians. . This is because on the road, the number of traffic signs is relatively small relative to objects such as vehicles or pedestrians, which causes data imbalance. When encountering data imbalance, the traditional classification algorithm that takes the overall classification accuracy as the learning objective will pay too much attention to the majority of objects, so that the performance of the classification of the minority objects is reduced.

本發明提供一種訓練影像產生方法與電子裝置,可以增加訓練影像中某特定物件(例如,交通標誌)的數量,藉此在使用訓練影像訓練用於識別該特定物件的模型後,可以有較高的預測準確率,並且避免資料不平衡所帶來的問題。The present invention provides a training image generation method and electronic device, which can increase the number of a specific object (for example, a traffic sign) in the training image, so that after the training image is used to train a model for recognizing the specific object, it can achieve higher results. The accuracy rate of forecasting, and avoid the problems caused by data imbalance.

本發明提出一種訓練影像產生方法,用於一電子裝置,所述方法包括:獲得包含一特定物件的一第一影像;去除所述第一影像中非屬於所述特定物件的部份以獲得對應所述特定物件的一第二影像;決定一目標影像中的一第一位置;根據所述第一位置,將所述第二影像中的所述特定物件貼至所述目標影像中以產生一訓練影像;以及使用所述訓練影像訓練用於識別所述特定物件的一模型。The present invention provides a method for generating training images for use in an electronic device. The method includes: obtaining a first image containing a specific object; removing parts of the first image that do not belong to the specific object to obtain a corresponding A second image of the specific object; determining a first position in a target image; according to the first position, pasting the specific object in the second image to the target image to generate a Training images; and using the training images to train a model for recognizing the specific object.

本發明提出一種電子裝置,包括:處理器。處理器用以執行下述運作:獲得包含一特定物件的一第一影像;去除所述第一影像中非屬於所述特定物件的部份以獲得對應所述特定物件的一第二影像;決定一目標影像中的一第一位置;根據所述第一位置,將所述第二影像中的所述特定物件貼至所述目標影像中以產生一訓練影像;以及使用所述訓練影像訓練用於識別所述特定物件的一模型。The present invention provides an electronic device including: a processor. The processor is configured to perform the following operations: obtain a first image including a specific object; remove parts of the first image that do not belong to the specific object to obtain a second image corresponding to the specific object; and determine a A first position in the target image; according to the first position, paste the specific object in the second image to the target image to generate a training image; and use the training image for training Identify a model of the specific object.

基於上述,本發明的訓練影像產生方法與電子裝置,可以增加訓練影像中某特定物件(例如,交通標誌)的數量,藉此在使用訓練影像訓練用於識別該特定物件的模型後,可以有較高的預測準確率,並且避免資料不平衡所帶來的問題。Based on the foregoing, the training image generation method and electronic device of the present invention can increase the number of a specific object (for example, a traffic sign) in the training image, so that after the training image is used to train a model for identifying the specific object, there may be Higher prediction accuracy rate, and avoid the problems caused by data imbalance.

為讓本發明的上述特徵和優點能更明顯易懂,下文特舉實施例,並配合所附圖式作詳細說明如下。In order to make the above-mentioned features and advantages of the present invention more comprehensible, the following specific embodiments are described in detail in conjunction with the accompanying drawings.

現將詳細參考本發明之示範性實施例,在附圖中說明所述示範性實施例之實例。另外,凡可能之處,在圖式及實施方式中使用相同標號的元件/構件代表相同或類似部分。Now referring to the exemplary embodiments of the present invention in detail, examples of the exemplary embodiments are illustrated in the accompanying drawings. In addition, wherever possible, elements/components with the same reference numbers in the drawings and embodiments represent the same or similar parts.

圖1是依照本發明的一實施例所繪示的電子裝置的方塊圖。FIG. 1 is a block diagram of an electronic device according to an embodiment of the invention.

請參照圖1,電子裝置100包括處理器20、輸入輸出電路22以及儲存電路24。其中,輸入輸出電路22以及儲存電路24分別耦接至處理器20。電子裝置100例如是桌上型電腦、伺服器、手機、平板電腦、筆記型電腦等電子行動裝置,在此不設限。Please refer to FIG. 1, the electronic device 100 includes a processor 20, an input/output circuit 22 and a storage circuit 24. Among them, the input/output circuit 22 and the storage circuit 24 are respectively coupled to the processor 20. The electronic device 100 is, for example, an electronic mobile device such as a desktop computer, a server, a mobile phone, a tablet computer, a notebook computer, etc., which is not limited herein.

處理器20可以是中央處理器(Central Processing Unit,CPU),或是其他可程式化之一般用途或特殊用途的微處理器(Microprocessor)、數位信號處理器(Digital Signal Processor,DSP)、可程式化控制器、特殊應用積體電路(Application Specific Integrated Circuit,ASIC)或其他類似元件或上述元件的組合。The processor 20 may be a central processing unit (Central Processing Unit, CPU), or other programmable general-purpose or special-purpose microprocessors (Microprocessor), digital signal processors (Digital Signal Processor, DSP), programmable Integrated circuit (Application Specific Integrated Circuit, ASIC) or other similar components or a combination of the above components.

輸入輸出電路22例如是用於從電子裝置100外部或其他來源取得相關資料的輸入介面或電路。此外,輸入輸出電路22也可以將電子裝置100產生的資料傳送給其他電子裝置的輸出介面或電路,在此並不設限。The input/output circuit 22 is, for example, an input interface or circuit for obtaining relevant data from outside the electronic device 100 or other sources. In addition, the input/output circuit 22 can also transmit the data generated by the electronic device 100 to the output interface or circuit of other electronic devices, which is not limited herein.

儲存電路24可以是任何型態的固定或可移動隨機存取記憶體(random access memory,RAM)、唯讀記憶體(read-only memory,ROM)、快閃記憶體(flash memory)或類似元件或上述元件的組合。The storage circuit 24 can be any type of fixed or removable random access memory (RAM), read-only memory (ROM), flash memory (flash memory) or similar components Or a combination of the above elements.

在本範例實施例中,電子裝置100的儲存電路24中儲存有多個程式碼片段,在上述程式碼片段被安裝後,會由處理器20來執行。例如,儲存電路24中包括多個模組,藉由這些模組來分別執行應用於電子裝置100的訓練影像產生方法的各個運作,其中各模組是由一或多個程式碼片段所組成。然而本發明不限於此,電子裝置100的各個運作也可以是使用其他硬體形式的方式來實現。In this exemplary embodiment, a plurality of code fragments are stored in the storage circuit 24 of the electronic device 100, and after the above-mentioned code fragments are installed, they will be executed by the processor 20. For example, the storage circuit 24 includes a plurality of modules, and each operation of the training image generation method applied to the electronic device 100 is executed by these modules, and each module is composed of one or more code fragments. However, the present invention is not limited to this, and various operations of the electronic device 100 may also be implemented in other hardware forms.

在先進駕駛輔助系統(Advanced Driver Assistance System,ADAS)中,可以配置有被訓練用來識別一影像中的特定物件(例如,交通標誌或車輛)的模型。一般來說,用於訓練前述模型的訓練影像通常是從行車記錄器採集到的影像。然而在實際場景中,車輛的個數通常遠大於交通標誌的個數,此情況導致訓練資料不平衡的問題。在訓練影像中交通標誌較少的情況下,卷積神經網路的模型訓練結果會對車輛有較好的識別率,但是交通標誌準確率確很低。In the Advanced Driver Assistance System (ADAS), a model trained to recognize a specific object (for example, a traffic sign or a vehicle) in an image can be configured. Generally speaking, the training images used to train the aforementioned models are usually images collected from a driving recorder. However, in actual scenes, the number of vehicles is usually much larger than the number of traffic signs, which leads to the problem of unbalanced training data. In the case of fewer traffic signs in the training image, the model training result of the convolutional neural network will have a better recognition rate for the vehicle, but the accuracy of the traffic signs is indeed very low.

因此,本發明提出一種訓練影像產生方法,用以增加訓練影像中某特定物件(例如,交通標誌)的數量,藉此在使用訓練影像訓練用於識別該特定物件的模型後,該模型可以有較高的準確率。Therefore, the present invention proposes a training image generation method to increase the number of a specific object (for example, a traffic sign) in the training image, so that after the training image is used to train a model for recognizing the specific object, the model can have Higher accuracy rate.

以下以訓練用以識別一影像中的交通標誌的模型為範例進行說明。特別是,為了提高模型的預測準確度,需增加訓練影像中交通標誌的數量。The following is an example of a model trained to recognize a traffic sign in an image. In particular, in order to improve the prediction accuracy of the model, it is necessary to increase the number of traffic signs in the training image.

圖2是依照本發明的一實施例所繪示的第一影像的示意圖。圖3是依照本發明的一實施例所繪示的目標影像的示意圖。FIG. 2 is a schematic diagram of a first image drawn according to an embodiment of the invention. FIG. 3 is a schematic diagram of a target image drawn according to an embodiment of the invention.

請同時參照圖2與圖3,在此假設處理器20欲增加目標影像32中交通標誌的數量以產生訓練影像。首先,處理器20例如可以透過輸入輸出電路22獲得包含交通標誌的影像30(亦稱為,第一影像)。例如,可以透過一標註工具軟體從一原始影像中擷取出包含交通標誌的影像30。或者,影像30也可以是藉由使用者手動地從原始影像中框選出,在此並不作限制。Please refer to FIGS. 2 and 3 at the same time. Here, it is assumed that the processor 20 intends to increase the number of traffic signs in the target image 32 to generate training images. First, the processor 20 may obtain an image 30 (also referred to as a first image) containing a traffic sign through the input/output circuit 22, for example. For example, an image 30 containing traffic signs can be extracted from an original image through a tagging tool software. Alternatively, the image 30 can also be manually selected from the original image by the user, which is not limited here.

在本實施例中,當影像30大於目標影像32時,處理器20會(例如,隨機地)決定一縮小倍率,並根據此縮小倍率將影像30縮小以使得影像30的大小小於目標影像32的大小。此外,當影像30非大於目標影像32時,處理器20可以不用對影像30進行縮小。In this embodiment, when the image 30 is larger than the target image 32, the processor 20 will (for example, randomly) determine a reduction magnification, and reduce the image 30 according to the reduction magnification so that the size of the image 30 is smaller than that of the target image 32. size. In addition, when the image 30 is not larger than the target image 32, the processor 20 may not reduce the image 30.

詳細來說,在此假設影像30具有寬度w0 與高度h0 ,目標影像32具有寬度w與高度h。當寬度w0 大於寬度w或高度h0 大於高度h時,處理器20會判斷影像30大於目標影像32。此時,處理器20會決定一縮小倍率,並根據此縮小倍率將影像30縮小以使得影像30的大小小於目標影像32的大小。In detail, it is assumed here that the image 30 has a width w 0 and a height h 0 , and the target image 32 has a width w and a height h. When the width w 0 is greater than the width w or the height h 0 is greater than the height h, the processor 20 will determine that the image 30 is larger than the target image 32. At this time, the processor 20 determines a reduction magnification, and reduces the image 30 according to the reduction magnification so that the size of the image 30 is smaller than the size of the target image 32.

接著,處理器20會去除影像30中非屬於交通標誌的部份以獲得對應交通標誌的影像(以下稱為,第二影像)。例如,處理器20可以將影像30乘以一遮罩矩陣以獲得前述的第二影像。Then, the processor 20 removes parts of the image 30 that are not traffic signs to obtain an image corresponding to the traffic sign (hereinafter referred to as the second image). For example, the processor 20 may multiply the image 30 by a mask matrix to obtain the aforementioned second image.

更詳細來說,圖4A與圖4B是依照本發明的一實施例所繪示的使用遮罩去除影像中非屬於交通標誌的部份的示意圖。In more detail, FIGS. 4A and 4B are schematic diagrams of using a mask to remove parts of an image that are not traffic signs according to an embodiment of the present invention.

首先,請參照圖4A,首先,處理器20可以根據前述的影像30的大小決定一遮罩矩陣40。例如,處理器20會將遮罩矩陣40的大小調整為符合影像30(或縮小後的影像30)的大小。在本實施例中,遮罩矩陣40包括(2*r0 +1)列與(2*r0 +1)行,r0 為一非零的正整數。在本實施例中,r0 為影像30中交通標誌的半徑。此外,處理器20會使用下述公式(1)設定遮罩矩陣40中第i列第j行的值:

Figure 02_image002
-------------------------公式(1)First, please refer to FIG. 4A. First, the processor 20 can determine a mask matrix 40 according to the size of the aforementioned image 30. For example, the processor 20 adjusts the size of the mask matrix 40 to match the size of the image 30 (or the reduced image 30). In this embodiment, the mask matrix 40 includes (2*r 0 +1) columns and (2*r 0 +1) rows, and r 0 is a non-zero positive integer. In this embodiment, r 0 is the radius of the traffic sign in the image 30. In addition, the processor 20 uses the following formula (1) to set the value of the i-th column and the j-th row in the mask matrix 40:
Figure 02_image002
-------------------------Formula 1)

也就是說,當(i-r0 )2 +(j-r0 )2 小於r0 2 時,處理器20會將遮罩矩陣40中第i列第j行的值設定為1。當(i-r0 )2 +(j-r0 )2 非小於r0 2 時,處理器20會將遮罩矩陣40中第i列第j行的值設定為0。其中,i與j分別為大於零且小於或等於(2*r0 +1)的正整數。That is, when (ir 0 ) 2 +(jr 0 ) 2 is less than r 0 2 , the processor 20 will set the value of the i-th column and the j-th row in the mask matrix 40 to 1. When (ir 0 ) 2 +(jr 0 ) 2 is not less than r 0 2 , the processor 20 will set the value of the i-th column and the j-th row in the mask matrix 40 to 0. Among them, i and j are respectively positive integers greater than zero and less than or equal to (2*r 0 +1).

在決定出遮罩矩陣40後,請參照圖4B,處理器20會將影像30乘以遮罩矩陣40以獲得影像60。在此,影像60即前述的第二影像。特別是影像60中僅剩下交通標誌且非屬於交通標誌的部份已去除。After the mask matrix 40 is determined, referring to FIG. 4B, the processor 20 multiplies the image 30 by the mask matrix 40 to obtain the image 60. Here, the image 60 is the aforementioned second image. In particular, only the traffic signs are left in the image 60 and the parts that are not traffic signs have been removed.

之後,圖5是依照本發明的一實施例所繪示的產生訓練影像的示意圖。After that, FIG. 5 is a schematic diagram of generating training images according to an embodiment of the present invention.

請參照圖5,處理器20在目標影像32中決定(例如,隨機地)一個位置

Figure 02_image004
(亦稱為,第一位置)。處理器20會根據此第一位置,將影像60中的交通標誌(不含背景部份)貼至目標影像32中以產生一訓練影像90。需注意的是,前述的
Figure 02_image006
需要滿足
Figure 02_image008
,藉此避免影像60超越目標影像32的邊界。其中,s為前述的縮小倍率。Referring to FIG. 5, the processor 20 determines (for example, randomly) a position in the target image 32
Figure 02_image004
(Also known as the first position). The processor 20 will paste the traffic sign (excluding the background part) in the image 60 to the target image 32 according to the first position to generate a training image 90. It should be noted that the aforementioned
Figure 02_image006
Need to meet
Figure 02_image008
This prevents the image 60 from exceeding the boundary of the target image 32. Among them, s is the aforementioned reduction magnification.

之後,處理器20可以重新選擇影像並且重複上述的步驟,即可在訓練影像90中產生其他更多的交通標誌。而在產生訓練影像90後,處理器20可以使用訓練影像90訓練用於識別交通標誌的模型。After that, the processor 20 can reselect the image and repeat the above steps to generate more traffic signs in the training image 90. After the training image 90 is generated, the processor 20 can use the training image 90 to train a model for recognizing traffic signs.

特別是,前述產生訓練影像的流程可以以虛擬碼(pseudo code)簡單表示如下: For train image --

Figure 02_image010
in training set 1.       Random choose a fake traffic sigin image as
Figure 02_image012
2.       Get
Figure 02_image012
‘s width and height
Figure 02_image014
and
Figure 02_image016
‘s width and height
Figure 02_image018
3.       If
Figure 02_image020
or
Figure 02_image022
: Random set
Figure 02_image024
which satisfy
Figure 02_image026
and
Figure 02_image028
else Set
Figure 02_image030
4.       resize
Figure 02_image012
with scale
Figure 02_image032
5.       resize
Figure 02_image034
with the same shape as
Figure 02_image012
6.       Random choose
Figure 02_image012
‘s position in
Figure 02_image016
as
Figure 02_image036
7.
Figure 02_image038
8.       paste
Figure 02_image012
to
Figure 02_image016
: for
Figure 02_image040
for
Figure 02_image042
if
Figure 02_image044
Figure 02_image046
9.       Repeat step 1 to 8 to fake more traffic signIn particular, the aforementioned process of generating training images can be simply expressed in pseudo code as follows: For train image -
Figure 02_image010
in training set 1. Random choose a fake traffic sigin image as
Figure 02_image012
2. Get
Figure 02_image012
's width and height
Figure 02_image014
and
Figure 02_image016
's width and height
Figure 02_image018
3. If
Figure 02_image020
or
Figure 02_image022
: Random set
Figure 02_image024
which satisfy
Figure 02_image026
and
Figure 02_image028
else Set
Figure 02_image030
4. resize
Figure 02_image012
with scale
Figure 02_image032
5. resize
Figure 02_image034
with the same shape as
Figure 02_image012
6. Random choose
Figure 02_image012
's position in
Figure 02_image016
as
Figure 02_image036
7.
Figure 02_image038
8. paste
Figure 02_image012
to
Figure 02_image016
: for
Figure 02_image040
for
Figure 02_image042
if
Figure 02_image044
Figure 02_image046
9. Repeat step 1 to 8 to fake more traffic sign

圖6是依照本發明的一實施例所繪示的訓練影像產生方法的示意圖。FIG. 6 is a schematic diagram of a training image generation method according to an embodiment of the invention.

請參照圖6,在步驟S601中,處理器20獲得包含特定物件的第一影像。在步驟S603中,處理器20去除第一影像中非屬於特定物件的部份以獲得對應於特定物件的第二影像。在步驟S605中,處理器20決定目標影像中的第一位置。在步驟S607中,處理器20根據第一位置,將第二影像中的特定物件貼至目標影像中以產生訓練影像。最後在步驟S609中,處理器20使用訓練影像訓練用於識別特定物件的模型。Referring to FIG. 6, in step S601, the processor 20 obtains a first image containing a specific object. In step S603, the processor 20 removes the part of the first image that does not belong to the specific object to obtain a second image corresponding to the specific object. In step S605, the processor 20 determines the first position in the target image. In step S607, the processor 20 pastes the specific object in the second image to the target image according to the first position to generate a training image. Finally, in step S609, the processor 20 uses the training images to train a model for identifying specific objects.

綜上所述,本發明的訓練影像產生方法與電子裝置可以增加訓練影像中某特定物件(例如,交通標誌)的數量,藉此在使用訓練影像訓練用於識別該特定物件的模型後,可以有較高的預測準確率。In summary, the training image generation method and electronic device of the present invention can increase the number of a specific object (for example, a traffic sign) in the training image, so that after the training image is used to train a model for recognizing the specific object, Have a higher prediction accuracy rate.

雖然本發明已以實施例揭露如上,然其並非用以限定本發明,任何所屬技術領域中具有通常知識者,在不脫離本發明的精神和範圍內,當可作些許的更動與潤飾,故本發明的保護範圍當視後附的申請專利範圍所界定者為準。Although the present invention has been disclosed in the above embodiments, it is not intended to limit the present invention. Anyone with ordinary knowledge in the relevant technical field can make some changes and modifications without departing from the spirit and scope of the present invention. The protection scope of the present invention shall be subject to those defined by the attached patent application scope.

100:電子裝置 20:處理器 22:輸入輸出電路 24:儲存電路 w、w0 :寬 h、h0 :高 30、60:影像 32:目標影像 40:矩陣 90:訓練影像 S601~S609:步驟100: electronic device 20: processor 22: input and output circuit 24: storage circuit w, w 0 : width h, h 0 : height 30, 60: image 32: target image 40: matrix 90: training image S601~S609: step

圖1是依照本發明的一實施例所繪示的電子裝置的方塊圖。 圖2是依照本發明的一實施例所繪示的第一影像的示意圖。 圖3是依照本發明的一實施例所繪示的目標影像的示意圖。 圖4A與圖4B是依照本發明的一實施例所繪示的使用遮罩去除影像中非屬於交通標誌的部份的示意圖。 圖5是依照本發明的一實施例所繪示的產生訓練影像的示意圖。 圖6是依照本發明的一實施例所繪示的訓練影像產生方法的示意圖。FIG. 1 is a block diagram of an electronic device according to an embodiment of the invention. FIG. 2 is a schematic diagram of a first image drawn according to an embodiment of the invention. FIG. 3 is a schematic diagram of a target image drawn according to an embodiment of the invention. 4A and 4B are schematic diagrams of using a mask to remove parts of an image that are not traffic signs according to an embodiment of the present invention. FIG. 5 is a schematic diagram of generating training images according to an embodiment of the present invention. FIG. 6 is a schematic diagram of a training image generation method according to an embodiment of the invention.

S601~S609:步驟 S601~S609: steps

Claims (10)

一種訓練影像產生方法,用於一電子裝置,所述方法包括:獲得包含一特定物件的一第一影像;去除所述第一影像中非屬於所述特定物件的部份以獲得對應所述特定物件的一第二影像,其中所述第二影像是藉由將所述第一影像乘以一遮罩矩陣而獲得;決定一目標影像中的一第一位置;根據所述第一位置,將所述第二影像中的所述特定物件貼至所述目標影像中以產生一訓練影像;以及使用所述訓練影像訓練用於識別所述特定物件的一模型,其中當所述第一影像大於所述目標影像時,決定一縮小倍率並根據所述縮小倍率將所述第一影像縮小以使得所述第一影像的尺寸小於所述目標影像的尺寸;以及將所述遮罩矩陣的大小調整為符合所述縮小後的所述第一影像的尺寸。 A method for generating training images for an electronic device, the method comprising: obtaining a first image containing a specific object; removing parts of the first image that are not part of the specific object to obtain a corresponding portion of the specific object. A second image of the object, wherein the second image is obtained by multiplying the first image by a mask matrix; determining a first position in a target image; according to the first position, Paste the specific object in the second image to the target image to generate a training image; and use the training image to train a model for recognizing the specific object, wherein when the first image is larger than When determining the target image, a reduction magnification is determined and the first image is reduced according to the reduction magnification so that the size of the first image is smaller than the size of the target image; and the size of the mask matrix is adjusted To meet the size of the reduced first image. 如申請專利範圍第1項所述的訓練影像產生方法,其中獲得包含所述特定物件的所述第一影像的步驟包括:使用一標註工具從一原始影像中擷取出包含所述特定物件的所述第一影像。 The training image generation method described in claim 1, wherein the step of obtaining the first image containing the specific object includes: using an annotation tool to extract all the images containing the specific object from an original image The first image. 如申請專利範圍第1項所述的訓練影像產生方法,其中將所述第一影像乘以所述遮罩矩陣的步驟之前,所述方法更包括: 決定所述遮罩矩陣,其中所述遮罩矩陣包括(2*r0+1)列與(2*r0+1)行,r0為一非零的正整數。 The training image generation method according to the first item of the patent application, wherein before the step of multiplying the first image by the mask matrix, the method further includes: determining the mask matrix, wherein the mask matrix The mask matrix includes (2*r 0 +1) columns and (2*r 0 +1) rows, and r 0 is a non-zero positive integer. 如申請專利範圍第3項所述的訓練影像產生方法,更包括:當(i-r0)2+(j-r0)2小於r0 2時,將所述遮罩矩陣中第i列第j行的值設定為1;以及當(i-r0)2+(j-r0)2非小於r0 2時,將所述遮罩矩陣中第i列第j行的值設定為0。 As described in item 3 of the scope of patent application, the training image generation method further includes: when (ir 0 ) 2 +(jr 0 ) 2 is less than r 0 2 The value is set to 1; and when (ir 0 ) 2 +(jr 0 ) 2 is not less than r 0 2 , the value of the i-th column and j-th row in the mask matrix is set to 0. 如申請專利範圍第1項所述的訓練影像產生方法,其中所述特定物件為一交通標誌。 According to the training image generation method described in item 1 of the scope of patent application, the specific object is a traffic sign. 一種電子裝置,包括:一處理器,其中所述處理器獲得包含一特定物件的一第一影像,所述處理器去除所述第一影像中非屬於所述特定物件的部份以獲得對應所述特定物件的一第二影像,其中所述第二影像是藉由將所述第一影像乘以一遮罩矩陣而獲得,所述處理器決定一目標影像中的一第一位置,所述處理器根據所述第一位置,將所述第二影像中的所述特定物件貼至所述目標影像中以產生一訓練影像,所述處理器使用所述訓練影像訓練用於識別所述特定物件的一模型,其中當所述第一影像大於所述目標影像時, 所述處理器決定一縮小倍率並根據所述縮小倍率將所述第一影像縮小以使得所述第一影像的尺寸小於所述目標影像的尺寸,所述處理器將所述遮罩矩陣的大小調整為符合所述縮小後的所述第一影像的尺寸。 An electronic device comprising: a processor, wherein the processor obtains a first image including a specific object, and the processor removes a part of the first image that does not belong to the specific object to obtain a corresponding A second image of the specific object, wherein the second image is obtained by multiplying the first image by a mask matrix, the processor determines a first position in a target image, the The processor pastes the specific object in the second image to the target image according to the first position to generate a training image, and the processor uses the training image to train for recognizing the specific A model of an object, wherein when the first image is larger than the target image, The processor determines a reduction magnification and reduces the first image according to the reduction magnification so that the size of the first image is smaller than the size of the target image, and the processor reduces the size of the mask matrix Adjusted to fit the size of the reduced first image. 如申請專利範圍第6項所述的電子裝置,其中在獲得包含所述特定物件的所述第一影像的運作中,所述處理器使用一標註工具從一原始影像中擷取出包含所述特定物件的所述第一影像。 The electronic device described in claim 6, wherein in the operation of obtaining the first image containing the specific object, the processor uses a tagging tool to extract from an original image that contains the specific object. The first image of the object. 如申請專利範圍第6項所述的電子裝置,其中在將所述第一影像乘以所述遮罩矩陣的運作之前,所述處理器決定所述遮罩矩陣,其中所述遮罩矩陣包括(2*r0+1)列與(2*r0+1)行,r0為一非零的正整數。 The electronic device according to claim 6, wherein before the operation of multiplying the first image by the mask matrix, the processor determines the mask matrix, wherein the mask matrix includes (2*r 0 +1) column and (2*r 0 +1) row, r 0 is a non-zero positive integer. 如申請專利範圍第8項所述的電子裝置,其中當(i-r0)2+(j-r0)2小於r0 2時,所述處理器將所述遮罩矩陣中第i列第j行的值設定為1,當(i-r0)2+(j-r0)2非小於r0 2時,所述處理器將所述遮罩矩陣中第i列第j行的值設定為0。 The electronic device described in item 8 of the scope of patent application, wherein when (ir 0 ) 2 + (jr 0 ) 2 is less than r 0 2 , the processor will The value is set to 1, and when (ir 0 ) 2 + (jr 0 ) 2 is not less than r 0 2 , the processor sets the value of the i-th column and the j-th row in the mask matrix to 0. 如申請專利範圍第6項所述的電子裝置,其中所述特定物件為一交通標誌。 The electronic device described in item 6 of the scope of patent application, wherein the specific object is a traffic sign.
TW108131658A 2019-08-09 2019-09-03 Training image generating method and electronic device TWI734186B (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910733079.1A CN110414480A (en) 2019-08-09 2019-08-09 Training image generation method and electronic device
CN201910733079.1 2019-08-09

Publications (2)

Publication Number Publication Date
TW202111595A TW202111595A (en) 2021-03-16
TWI734186B true TWI734186B (en) 2021-07-21

Family

ID=68366755

Family Applications (1)

Application Number Title Priority Date Filing Date
TW108131658A TWI734186B (en) 2019-08-09 2019-09-03 Training image generating method and electronic device

Country Status (2)

Country Link
CN (1) CN110414480A (en)
TW (1) TWI734186B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111160481B (en) * 2019-12-31 2024-05-10 苏州安智汽车零部件有限公司 Adas target detection method and system based on deep learning
CN113705593A (en) * 2020-05-21 2021-11-26 孙民 Method for generating training data and electronic device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8571317B2 (en) * 2010-01-15 2013-10-29 Gruntworx, Llc Systems and methods for automatically processing electronic documents using multiple image transformation algorithms
TWI494899B (en) * 2012-12-19 2015-08-01 Ind Tech Res Inst Method for in-image periodic noise reparation
TW201909028A (en) * 2017-05-04 2019-03-01 宏達國際電子股份有限公司 Image processing method, non-transitory computer readable medium and image processing system
TWI662355B (en) * 2018-03-12 2019-06-11 緯創資通股份有限公司 Image background removing system, image background changing apparatus, image background removing method, and computer program product thereof

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102800058B (en) * 2012-07-06 2015-05-27 哈尔滨工程大学 Remote sensing image cloud removing method based on sparse representation
EP3029628A1 (en) * 2014-12-05 2016-06-08 Delphi Technologies, Inc. Method for generating a training image
CN106056158B (en) * 2016-06-03 2019-06-21 西安电子科技大学 Template image global search method based on mask matrix and fast Fourier transform
CN106485676B (en) * 2016-09-29 2019-10-11 天津大学 A kind of LiDAR point cloud data recovery method based on sparse coding
CN106599869B (en) * 2016-12-22 2019-12-03 安徽大学 A vehicle attribute recognition method based on multi-task convolutional neural network
CN108236784B (en) * 2018-01-22 2021-09-24 腾讯科技(深圳)有限公司 Model training method and device, storage medium and electronic device
CN109146830A (en) * 2018-07-17 2019-01-04 北京旷视科技有限公司 For generating the method, apparatus, system and storage medium of training data
CN109816014A (en) * 2019-01-22 2019-05-28 天津大学 A method for generating annotated datasets for deep learning target detection network training
CN110008832A (en) * 2019-02-27 2019-07-12 西安电子科技大学 Based on deep learning character image automatic division method, information data processing terminal
CN110047064B (en) * 2019-03-27 2021-03-19 中国农业机械化科学研究院 A kind of potato scab detection method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8571317B2 (en) * 2010-01-15 2013-10-29 Gruntworx, Llc Systems and methods for automatically processing electronic documents using multiple image transformation algorithms
TWI494899B (en) * 2012-12-19 2015-08-01 Ind Tech Res Inst Method for in-image periodic noise reparation
TW201909028A (en) * 2017-05-04 2019-03-01 宏達國際電子股份有限公司 Image processing method, non-transitory computer readable medium and image processing system
TWI662355B (en) * 2018-03-12 2019-06-11 緯創資通股份有限公司 Image background removing system, image background changing apparatus, image background removing method, and computer program product thereof

Also Published As

Publication number Publication date
CN110414480A (en) 2019-11-05
TW202111595A (en) 2021-03-16

Similar Documents

Publication Publication Date Title
Nguyen Improving Faster R‐CNN Framework for Fast Vehicle Detection
US9760800B2 (en) Method and system to detect objects using block based histogram of oriented gradients
CN112132156A (en) Multi-depth feature fusion image saliency target detection method and system
JP7230294B2 (en) System and method for object detection
CN106157283A (en) The detection method of lane segmentation thing and device
CN111079669A (en) An image processing method, device and storage medium
CN116229406B (en) Lane marking detection method, system, electronic device and storage medium
Alam et al. Faster RCNN based robust vehicle detection algorithm for identifying and classifying vehicles
CN111950501B (en) Obstacle detection method and device and electronic equipment
TWI734186B (en) Training image generating method and electronic device
CN107292303A (en) Method and apparatus for license plate inspection with edge type sliding concentric window
CN111626298B (en) Real-time image semantic segmentation device and segmentation method
CN116311290A (en) Handwritten and printed text detection method and device based on deep learning
Zhao et al. An efficient real-time FPGA implementation for object detection
CN111507999B (en) A target tracking method and device based on FDSST algorithm
CN112837404B (en) A method and device for constructing three-dimensional information of plane objects
WO2011037097A1 (en) Pattern recognition method and pattern recognition device using the method
CN114399724A (en) Pedestrian re-identification method and device, electronic equipment and storage medium
CN111291767B (en) A fine-grained identification method, terminal equipment, and computer-readable storage medium
CN113569838A (en) Text recognition method and device based on text detection algorithm
US20240362470A1 (en) Panoptic perception system, method thereof and non-transitory computer-readable media
CN115294339B (en) Label fusion method and device, computer readable storage medium and terminal
CN112561889B (en) Target object detection method, device, electronic device and storage medium
CN116129420A (en) License plate classification method and device and nonvolatile storage medium
CN115205801A (en) Traffic accident prediction method, device, electronic device and storage medium