A training data acquisition method and device and a computer device
By extracting and sorting instrument frame images from instrument videos, removing backgrounds and processing sizes, and obtaining temporary parameters for the instrument region, the problem of excessively long manual annotation time is solved, and the efficiency of training data acquisition is improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SUZHOU KANGDUO ROBOT
- Filing Date
- 2022-10-27
- Publication Date
- 2026-05-01
AI Technical Summary
In existing technologies, the field of artificial intelligence and image recognition faces the problem of excessive time spent manually labeling the instrument area during the preprocessing of training data.
By acquiring equipment videos, sorting them according to preset standards, obtaining multiple equipment frame images, removing the background from each image to obtain the main body region image, obtaining the size and temporary parameters, and finally obtaining the training parameters.
This solves the problem of excessive time spent manually labeling equipment areas and improves the efficiency of training data acquisition.
Smart Images

Figure CN115690537B_ABST
Abstract
Description
A method, apparatus, and computer device for acquiring training data. Technical Field
[0001] This invention relates to the fields of artificial intelligence and image recognition, and more specifically, to a method, apparatus, and computer device for acquiring training data. Background Technology
[0002] Minimally invasive surgical visualization technology has brought about a revolutionary improvement in surgical diagnosis and treatment, offering advantages such as smaller incisions, less pain, and faster recovery. During the surgery, doctors and assistants can clearly observe the location of the lesion and coordinate accordingly, with a plethora of operational area prompts available. In contrast, current technologies in artificial intelligence and image recognition often employ supervised learning methods to improve recognition rates for training images and videos. Furthermore, the initial processing of training data frequently requires manual annotation of target information, which is time-consuming and labor-intensive. Summary of the Invention
[0003] The problem addressed by this invention is how to solve the issue of excessive time spent manually labeling equipment areas during data processing in the early stages of training.
[0004] To address the above problems, the present invention provides a method for acquiring training data, comprising the following steps:
[0005] Obtain instrument videos;
[0006] Based on the instrument video, multiple instrument frame images are obtained, wherein the multiple instrument frame images are sorted according to a preset standard;
[0007] The background of each instrument frame image is removed to obtain the main body area image of each instrument frame image;
[0008] Obtain the dimensions of each of the instrument frame images;
[0009] Based on the dimensions of the main region image and the instrument frame image, a temporary parameter of the main region is obtained for each instrument frame image, wherein the temporary parameter of the main region image is the percentage of the instrument frame image size.
[0010] If the current instrument frame is the last frame, training parameters are obtained based on all the main body region images and all the temporary parameters of the main body region.
[0011] Optionally, obtaining multiple instrument frame images based on the instrument video specifically includes:
[0012] The instrument frame image is obtained by projecting a binary encoded image over the camera area using a preset projection frequency;
[0013] The camera area is the display area for the video of the device.
[0014] Optionally, the step of removing the background from each instrument frame image to obtain the main body region image of each instrument frame image specifically includes:
[0015] Images carrying binary codes in each instrument frame image are filtered using color information detection;
[0016] Each image that does not carry binary encoding is processed into grayscale to obtain a grayscale image;
[0017] The grayscale image is subjected to background removal to obtain a preliminary screening image of the instrument area;
[0018] By removing the binary-coded regions from the image carrying binary codes, a distorted region image is obtained;
[0019] Based on the initial screening of the instrument area image and the deformed area image, a shadow area image is obtained;
[0020] The main body image is obtained based on the instrument area image, the shadow area image, and the deformed area image from the initial screening.
[0021] Optionally, the background removal operation on the grayscale image specifically includes:
[0022] Obtain the Gaussian distribution model;
[0023] The background removal operation is performed on the grayscale image using the Gaussian distribution model.
[0024] Optionally, the step of removing the background from the grayscale image to obtain the initially screened instrument region image specifically includes:
[0025] The grayscale image is subjected to background removal to obtain a first temporary image;
[0026] The first temporary image is binarized and subjected to morphological operations to obtain the instrument region image of the initial screening.
[0027] Optionally, obtaining the shadow region image based on the initially screened instrument region image and the deformed region image specifically includes:
[0028] After removing the overlapping portion of the instrument region image and the deformed region image from the initial screening, the remaining portions of the instrument region image and the deformed region image from the initial screening are merged to obtain the shadow region image.
[0029] Optionally, obtaining the main body region image based on the initially screened instrument region image, the shadow region image, and the deformed region image specifically includes:
[0030] The image of the shadowed area is processed to obtain a second temporary image;
[0031] Obtain the average brightness of the second temporary image;
[0032] A third temporary image is obtained based on the average brightness and the image of the instrument area from the initial screening.
[0033] The main region image is obtained based on the third temporary region image and the deformed region image.
[0034] Optionally, obtaining temporary parameters for the main body region of each instrument frame image based on the dimensions of the main body region image and the instrument frame image specifically includes:
[0035] Obtain the vertex coordinates of the circumscribed rectangular region of the main body image;
[0036] Based on the vertex coordinates of the circumscribed rectangle region and the size of the instrument frame image, the percentage of the main body region's circumscribed rectangle to the size of the instrument frame image is obtained;
[0037] The percentage of the outer rectangle of the main body region to the size of the instrument frame image is a temporary parameter of the main body region.
[0038] The advantage of the training data acquisition method described in this invention compared to existing technologies is that: This invention provides a method for acquiring training data by obtaining multiple instrument frame images based on instrument videos, and sorting these multiple instrument frame images according to a preset standard. By removing the background from each instrument frame image, the main body region image of each instrument frame image is obtained. By obtaining the size of each instrument frame image, temporary parameters of the main body region of each instrument frame image are obtained based on the main body region image and the size of the instrument frame image, until the current instrument frame image is the last frame. Training parameters are obtained based on all the main body region images and all the temporary parameters of the main body region, thus solving the problem of excessive time spent manually annotating instrument regions.
[0039] To address the aforementioned technical problems, the present invention also provides a training data acquisition device, comprising:
[0040] Acquisition unit, the acquisition unit is used to acquire instrument video;
[0041] The acquisition unit is further configured to acquire multiple instrument frame images based on the instrument video, wherein the multiple instrument frame images are sorted according to a preset standard;
[0042] The acquisition unit is also used to acquire the size of each instrument frame image;
[0043] The processing unit is used to remove the background from each instrument frame image to obtain the main body area image of each instrument frame image;
[0044] The processing unit is further configured to obtain temporary parameters of the main body region for each instrument frame image based on the main body region image and the instrument frame image size;
[0045] The processing unit is further configured to obtain training parameters based on all the subject region images and all the subject region temporary parameters if the current instrument frame image is the last frame.
[0046] The training data acquisition device and training data acquisition method described in this invention have the same advantages over the prior art, and will not be repeated here.
[0047] To address the aforementioned technical problems, the present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor executes the computer program to implement the steps of the training data acquisition method.
[0048] The computer equipment and training data acquisition method described in this invention have the same advantages over existing technologies, and will not be repeated here. Attached Figure Description
[0049] Figure 1 is an application environment diagram of the training data acquisition method in an embodiment of the present invention;
[0050] Figure 2 is a flowchart of the training data acquisition method in an embodiment of the present invention;
[0051] Figure 3 is a structural diagram of the training data acquisition device in an embodiment of the present invention;
[0052] Figure 4 is an internal structural diagram of the computer device in an embodiment of the present invention. Detailed Implementation
[0053] The technical solutions in the embodiments of this application will be clearly and thoroughly described below with reference to the accompanying drawings.
[0054] In the description of the embodiments in this application, the term "some embodiments" means that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same implementation or instance. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0055] In this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, without requiring or implying any actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed. The various embodiments described herein are presented in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For structures, products, etc., disclosed in the embodiments, the descriptions are relatively simple because they correspond to the disclosed parts; relevant details can be found in the method section.
[0056] Figure 1 illustrates the application environment of the training data acquisition method in this embodiment. Referring to Figure 1, the training data acquisition method is applied to a training data acquisition system. This system includes a terminal 110 and a server 120. The terminal 110 and server 120 are connected via a network. The terminal 110 can be a desktop terminal or a mobile terminal; the mobile terminal can be at least one of a mobile phone, tablet computer, or laptop computer. The server 120 can be a standalone server or a server cluster composed of multiple servers.
[0057] In one embodiment, a method for acquiring training data is provided. This embodiment mainly illustrates the application of this method to terminal 110 (or server 120) in Figure 1 above. Referring to Figure 2, the method for acquiring training data specifically includes the following steps:
[0058] Step S1: Acquire the instrument video;
[0059] Step S2: Based on the instrument video, acquire multiple instrument frame images, wherein the multiple instrument frame images are sorted according to a preset standard;
[0060] Step S3: Remove the background from each instrument frame image to obtain the main body area image of each instrument frame image;
[0061] Step S4: Obtain the dimensions of each instrument frame image;
[0062] Step S5: Based on the dimensions of the main body region image and the instrument frame image, obtain a temporary parameter of the main body region for each instrument frame image. The temporary parameter of the main body region is the percentage of the main body region image to the size of the instrument frame image.
[0063] Step S6: If the current instrument frame image is the last frame, obtain the training parameters based on all the main body region images and all the temporary parameters of the main body region.
[0064] In some preferred embodiments, the instrument video is acquired by loading, and the instrument video is preferably a surgical instrument video. The instrument frame image is read from the instrument video and saved according to the name format "instrument name_frame number" (preset standard). The current instrument frame image is processed. First, the background is removed, and then the main body region image of the instrument frame image is extracted. Temporary parameters of the main body region are obtained according to the size of the main body region image and the instrument frame image. After processing the last frame, training parameters are obtained according to all the main body region images and all the temporary parameters of the main body region. Finally, the training parameter file is saved according to the instrument name. The obtained training parameters are used for subsequent AI training.
[0065] AI refers to Artificial Intelligence, a new technical science that studies and develops theories, methods, technologies, and application systems for simulating, extending, and expanding human intelligence.
[0066] This embodiment provides a method for acquiring training data. Based on the instrument video, multiple instrument frame images are obtained, and these multiple instrument frame images are sorted according to a preset standard. By removing the background from each instrument frame image, the main body region image of each instrument frame image is obtained. By obtaining the size of each instrument frame image, temporary parameters of the main body region of each instrument frame image are obtained based on the main body region image and the size of the instrument frame image, until the current instrument frame image is the last frame. Training parameters are obtained based on all the main body region images and all the temporary parameters of the main body region, which solves the problem of excessive time spent manually annotating instrument regions.
[0067] In some embodiments, step S2, obtaining multiple instrument frame images based on the instrument video, specifically includes:
[0068] Step S21: The instrument frame image is obtained by projecting a binary encoded image to cover the camera area using a preset projection frequency;
[0069] The camera area is the display area for the video of the device.
[0070] In some preferred embodiments, the corresponding instrument video is acquired according to the user's needs, and the binary encoded image is projected to cover the camera area using a 10Hz projection frequency, and instrument frame images are acquired at a 10Hz frequency.
[0071] In some embodiments, step S3 involves removing the background from each instrument frame image to obtain the main body region image of each instrument frame image, specifically including:
[0072] Step S31: Filter the images carrying binary codes in each of the instrument frame images by color information detection;
[0073] Step S32: Perform grayscale processing on each image that does not carry binary encoding to obtain a grayscale image;
[0074] Step S33: Remove the background from the grayscale image to obtain the preliminary screening image of the instrument area;
[0075] Step S34: Obtain the malformed region image by removing the binary-coded region from the image carrying the binary code;
[0076] Step S35: Obtain the shadow area image based on the instrument area image and the deformed area image obtained from the initial screening;
[0077] Step S36: Obtain the main body region image based on the instrument region image, the shadow region image, and the deformed region image from the initial screening.
[0078] In some preferred embodiments, grayscale processing is the process of converting a color image into a grayscale image. When displaying color images on monitors such as computers, televisions, or mobile phones, the RGB model is a commonly used method for representing color information. The RGB model, also known as the additive color mixing model, uses the superposition of R (red), G (green), and B (blue) light to achieve color mixing, and is particularly suitable for light-emitting objects such as monitors. Grayscale conversion is the process of making the R, G, and B components of a color image equal, that is, setting R = G = B. The resulting color represents a grayscale color.
[0079] Image grayscale processing mainly includes the following methods: Component method: The brightness of the three components in the color image is used as the grayscale values of the three grayscale images. One grayscale image can be selected according to the application needs. Maximum value method: The maximum value of the brightness of the three components in the color image is used as the grayscale value of the grayscale image. Average method: The brightness of the three components in the color image is averaged to obtain a grayscale value. Weighted average method: The three components are weighted with different weights according to their importance and other indicators. Since the human eye is most sensitive to green and least sensitive to blue, a weighted average of the RGB components according to the following formula can obtain a more reasonable grayscale image.
[0080] In some embodiments, step S33, which involves removing the background from the grayscale image, specifically includes:
[0081] Step S331: Obtain the Gaussian distribution model;
[0082] Step S332: Remove the background from the grayscale image using the Gaussian distribution model.
[0083] In some preferred embodiments, a suitable number of Gaussian distributions are selected for each pixel based on the previous x frames. The Gaussian distribution mixture is used to model the background pixels. The duration of these colors in the video is used as the weight for the mixture. Background regions are then filtered, and the grayscale image is subjected to background removal based on the background regions.
[0084] The Gaussian distribution generally refers to the normal distribution, which is a very important probability distribution in mathematics, physics, engineering and other fields, and has a significant influence on many aspects of statistics.
[0085] In some embodiments, step S33 involves removing the background from the grayscale image to obtain a preliminary image of the instrument region, specifically including:
[0086] Step S333: Perform a background removal operation on the grayscale image to obtain a first temporary image;
[0087] Step S334: Binarize and perform morphological operations on the first temporary image to obtain the instrument region image of the initial screening.
[0088] In some preferred embodiments, image binarization involves setting the grayscale value of points in the image to 0 or 255, effectively giving the entire image a distinct black and white effect. This means obtaining a binarized image that still reflects the overall and local features of the image by selecting appropriate thresholds for a grayscale image with 256 brightness levels. Binary images play a crucial role in digital image processing, especially in practical applications. Many systems are built using binary image processing. To process and analyze binary images, the grayscale image must first be binarized. This allows for further image processing, as the set properties of the image depend only on the positions of pixels with a value of 0 or 255, eliminating the need for multi-level pixel values, simplifying the process and reducing data processing and compression. To obtain an ideal binary image, closed, connected boundaries are typically used to define non-overlapping regions. Pixels with a grayscale value greater than or equal to the threshold are considered to belong to a specific object and are represented by a grayscale value of 255. Otherwise, these pixels are excluded from the object region and have a grayscale value of 0, representing the background or an exception to the object region. If a specific object has a uniform grayscale value internally, and it is situated against a uniform background with other grayscale values, a thresholding method can yield relatively good segmentation results. If the difference between the object and the background is not in grayscale values (e.g., different textures), this difference can be converted into a difference in grayscale values, and then a thresholding technique can be used to segment the image. Dynamically adjusting the threshold to binarize the image allows for dynamic observation of the segmentation results.
[0089] In some preferred embodiments, morphological operations are image processing methods developed for binary images based on set theory methods of mathematical morphology. Typically, morphological image processing manifests as a neighborhood operation, where a specially defined domain is called a "structuring element." At each pixel location, it performs specific logical operations with the corresponding region in the binary image, and the result of these logical operations is the corresponding pixel in the output image. Simply put, morphological operations are a series of shape-based image processing operations that generate an output image by applying structuring elements to the input image.
[0090] In some embodiments, step S35, obtaining the shadow area image based on the initially screened instrument area image and the deformed area image, specifically includes:
[0091] Step S351: After removing the overlapping portion of the instrument region image and the deformed region image from the initial screening, the remaining portions of the instrument region image and the deformed region image from the initial screening are merged to obtain the shadow region image.
[0092] In some preferred embodiments, the image regions of the initial screening device region image and the deformed region image are intersected to obtain the intersection region, and the remaining region is used as the shadow region image of the initial screening device region image.
[0093] In some embodiments, step S36, obtaining the main body region image based on the initially screened instrument region image, the shadow region image, and the deformed region image, specifically includes:
[0094] Step S361: Perform grayscale processing on the image of the shadow area to obtain a second temporary image;
[0095] Step S362: Obtain the average brightness of the second temporary image;
[0096] Step S363: Based on the average brightness and the image of the instrument area from the initial screening, a third temporary image is obtained;
[0097] Step S364: Obtain the main region image based on the third temporary region image and the deformed region image.
[0098] In some preferred embodiments, the shadow portion is subtracted from the initially screened instrument region image based on the average grayscale brightness of the shadow region image to obtain a third temporary image. The average of the edges of the third temporary image and the malformed region image is taken as the final main body region, and an image containing the main body region of the instrument is output.
[0099] In some embodiments, step S5, based on the dimensions of the main region image and the instrument frame image, obtains temporary parameters for the main region of each instrument frame image, specifically including:
[0100] Step S51: Obtain the vertex coordinates of the circumscribed rectangular region of the main body region image;
[0101] Step S52: Based on the vertex coordinates of the circumscribed rectangle region and the size of the instrument frame image, obtain the percentage of the main body region's circumscribed rectangle to the size of the instrument frame image;
[0102] The percentage of the outer rectangle of the main body region to the size of the instrument frame image is a temporary parameter of the main body region.
[0103] In some preferred embodiments, the length and width of the instrument frame image are obtained, and temporary parameters of the main region are calculated based on the length and width of the instrument frame image and the vertex coordinates of the circumscribed rectangle of the main region image. These parameters are then output as a percentage of the instrument frame image containing the circumscribed rectangle of the main region for subsequent AI training.
[0104] This embodiment provides a method for acquiring training data. Based on the instrument video, multiple instrument frame images are obtained, and these multiple instrument frame images are sorted according to a preset standard. By removing the background from each instrument frame image, the main body region image of each instrument frame image is obtained. By obtaining the size of each instrument frame image, temporary parameters of the main body region of each instrument frame image are obtained based on the main body region image and the size of the instrument frame image, until the current instrument frame image is the last frame. Training parameters are obtained based on all the main body region images and all the temporary parameters of the main body region, which solves the problem of excessive time spent manually annotating instrument regions.
[0105] As shown in Figure 3, in one embodiment, a training data acquisition device is provided, including:
[0106] Acquisition unit 310, the acquisition unit 310 is used to acquire instrument video;
[0107] The acquisition unit 310 is further configured to acquire multiple instrument frame images based on the instrument video, wherein the multiple instrument frame images are sorted according to a preset standard;
[0108] The acquisition unit 310 is also used to acquire the size of each of the instrument frame images;
[0109] Processing unit 320 is used to remove the background from each instrument frame image to obtain the main body area image of each instrument frame image;
[0110] The processing unit 320 is further configured to obtain temporary parameters of the main body region of each instrument frame image based on the size of the main body region image and the instrument frame image;
[0111] The processing unit 320 is further configured to obtain training parameters based on all the subject region images and all the subject region temporary parameters when the current instrument frame image is the last frame.
[0112] In this embodiment, the acquisition unit 310 is further configured to obtain the instrument frame image by projecting a binary encoded image over the camera area using a preset projection frequency; wherein, the camera area is the display area of the instrument video.
[0113] In this embodiment, the processing unit 320 is further configured to: detect and filter images carrying binary codes in each instrument frame image using color information; perform grayscale processing on each image without binary codes to obtain a grayscale image; perform background removal on the grayscale image to obtain a preliminary instrument region image; remove the binary code region from the image carrying binary codes to obtain a deformed region image; obtain a shadow region image based on the preliminary instrument region image and the deformed region image; and obtain a main body region image based on the preliminary instrument region image, the shadow region image, and the deformed region image.
[0114] In this embodiment, the processing unit 320 is further configured to obtain the vertex coordinates of the circumscribed rectangle region of the main body region image; and to obtain the percentage of the main body region's circumscribed rectangle to the size of the instrument frame image based on the vertex coordinates of the circumscribed rectangle region and the size of the instrument frame image; wherein, the percentage of the main body region's circumscribed rectangle to the size of the instrument frame image is a temporary parameter of the main body region.
[0115] The training data acquisition device and training data acquisition method described in this invention have the same advantages over the prior art, and will not be repeated here.
[0116] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the above-described method for acquiring training data.
[0117] Figure 4 shows an internal structural diagram of a computer device in one embodiment. Specifically, this computer device may be the terminal 110 (or server 120) in Figure 1. As shown in Figure 4, the computer device includes a processor, memory, network interface, input device, and display screen connected via a system bus. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and may also store a computer program. When executed by the processor, this computer program enables the processor to implement a method for acquiring training data. The internal memory may also store a computer program, which, when executed by the processor, enables the processor to implement a method for acquiring training data. The display screen of the computer device may be a liquid crystal display (LCD) or an e-ink display. The input device may be a touch layer covering the display screen, or buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse, etc.
[0118] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements the steps of the above-described method for acquiring training data.
[0119] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments described above. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.
[0120] While the disclosure is as stated above, its scope of protection is not limited thereto. Those skilled in the art can make various changes and modifications without departing from the spirit and scope of this disclosure, and all such changes and modifications will fall within the protection scope of this invention.
Claims
1. A method for acquiring training data, characterized in that, The process includes the following steps: acquiring an instrument video; acquiring multiple instrument frame images based on the instrument video, wherein the multiple instrument frame images are sorted according to a preset standard; removing the background from each instrument frame image to obtain the main body region image of each instrument frame image, including: filtering images carrying binary codes in each instrument frame image through color information detection; performing grayscale processing on each image without binary codes to obtain a grayscale image; removing the background from the grayscale image to obtain a pre-screened instrument region image; and removing the binary code region from the images carrying binary codes to obtain a deformed region image. The process involves: obtaining a shadow region image based on the initially screened instrument region image and the deformed region image; obtaining a main body region image based on the initially screened instrument region image, the shadow region image, and the deformed region image; acquiring the size of each instrument frame image; obtaining temporary parameters for the main body region of each instrument frame image based on the size of the main body region image and the instrument frame image, wherein the temporary parameters for the main body region are the percentage of the main body region image to the size of the instrument frame image; and obtaining training parameters based on all the main body region images and all the temporary parameters for the main body region if the current instrument frame image is the last frame.
2. The method for acquiring training data according to claim 1, characterized in that, The step of obtaining multiple instrument frame images based on the instrument video specifically includes: projecting a binary encoded image to cover the camera area using a preset projection frequency to obtain the instrument frame images; wherein, the camera area is the display area of the instrument video.
3. The method for acquiring training data according to claim 1, characterized in that, The background removal operation on the grayscale image specifically includes: obtaining a Gaussian distribution model; and performing background removal on the grayscale image using the Gaussian distribution model.
4. The method for acquiring training data according to claim 1, characterized in that, The step of removing the background from the grayscale image to obtain the preliminary screening of the instrument region image specifically includes: removing the background from the grayscale image to obtain a first temporary image; and performing binarization and morphological operations on the first temporary image to obtain the preliminary screening of the instrument region image.
5. The method for acquiring training data according to claim 1, characterized in that, The step of obtaining the shadow region image based on the pre-screened instrument region image and the deformed region image specifically includes: removing the overlapping portion of the pre-screened instrument region image and the deformed region image, and then merging the remaining portions of the pre-screened instrument region image and the deformed region image to obtain the shadow region image.
6. The method for acquiring training data according to claim 1, characterized in that, The step of obtaining the main body region image based on the initially screened instrument region image, the shadow region image, and the deformed region image specifically includes: performing grayscale processing on the shadow region image to obtain a second temporary image; obtaining the average brightness of the second temporary image; obtaining a third temporary image based on the average brightness and the initially screened instrument region image; and obtaining the main body region image based on the third temporary region image and the deformed region image.
7. The method for acquiring training data according to claim 1, characterized in that, The step of obtaining temporary parameters of the main body region for each instrument frame image based on the dimensions of the main body region image and the instrument frame image specifically includes: obtaining the vertex coordinates of the circumscribed rectangle region of the main body region image; and obtaining the percentage of the main body region's circumscribed rectangle to the size of the instrument frame image based on the vertex coordinates of the circumscribed rectangle region and the dimensions of the instrument frame image; wherein, the percentage of the main body region's circumscribed rectangle to the size of the instrument frame image is the temporary parameter of the main body region.
8. A device for acquiring training data, characterized in that, include: The unit comprises an acquisition unit for acquiring instrument videos; the acquisition unit is further configured to acquire multiple instrument frame images based on the instrument videos, wherein the multiple instrument frame images are sorted according to a preset standard; the acquisition unit is also configured to acquire the size of each instrument frame image; and a processing unit for performing background removal operations on each instrument frame image to obtain a main body image of each instrument frame image, including: filtering images carrying binary codes in each instrument frame image through color information detection; performing grayscale processing on each image without binary codes to obtain a grayscale image; and performing background removal operations on the grayscale image to obtain a... The processing unit first selects an instrument region image; then removes the binary-coded region from the image carrying the binary code to obtain a deformed region image; finally, it obtains a shadow region image based on the first-screened instrument region image and the deformed region image; and finally, it obtains a main body region image based on the first-screened instrument region image, the shadow region image, and the deformed region image. The processing unit is further configured to obtain temporary parameters for the main body region of each instrument frame image based on the main body region image and the instrument frame image size. The processing unit is also configured to obtain training parameters based on all the main body region images and all the temporary parameters for the main body region if the current instrument frame image is the last frame.
9. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the training data acquisition method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Area-of-interest extracting method used for video monitoring
CN103077521A
Three-dimensional measuring method and system based on line structure light
CN110044292A