Disclosure of Invention
The embodiment of the invention provides an image feature extraction method, an image feature extraction device, a tumor recognition system and a storage medium, and solves the problem that the image feature extraction method in the prior art cannot extract image features which are easy to recognize tumors.
In a first aspect, an embodiment of the present invention provides an image feature extraction method, including:
acquiring a gray level pathological image of a pathological section;
controlling at least two masks with different scales to move on the gray pathological image pixel by pixel, calculating a characteristic value corresponding to each movement result, and splicing all the characteristic values corresponding to each mask together to form a characteristic vector for expressing the structural characteristics of the gray pathological image;
the mask comprises a white area and a black area which are opposite, and the black area is a rectangular area at least comprising one corner of the mask.
Further, acquiring a gray-scale pathology image of the pathology section includes:
at least two color pathological images with different resolutions of the same pathological section are converted into gray pathological images with the same resolution.
Further, the black area is square, and the number of rows and columns included is 1/4 of the number of rows and columns of the mask.
Further, the number of the masks is three, and is 2 × 2, 4 × 4, and 8 × 8, respectively.
Further, the controlling the at least two masks of different scales to move pixel by pixel on the gray-scale pathology image comprises:
controlling at least two masks with different scales to move on the corresponding integral image of the gray pathological image pixel by pixel;
each pixel point of the integral graph is the sum of gray values of all pixel points in a rectangular region surrounded by an upper left corner pixel point of the gray pathological image and each target pixel point, and the sum is specifically as follows:
wherein i (x ', y') is the gray value of the pixel point with the coordinate (x ', y'), and (x, y) is the coordinate of the target pixel point.
Further, the feature value corresponding to each movement result is:
f i =sum(M×Gray i )
wherein f is i And M is a coefficient matrix of the mask, and Grayi is a gray value matrix of a coverage area of the current mask on the integral graph.
In a second aspect, an embodiment of the present invention further provides an image feature extraction device, including:
the acquisition module is used for acquiring a gray pathological image of the pathological section;
the characteristic vector module is used for controlling at least two masks with different scales to move on the gray pathological image pixel by pixel, calculating characteristic values corresponding to each movement result, and splicing all the characteristic values corresponding to each mask together to form a characteristic vector for representing the structural characteristics of the gray pathological image, wherein the masks comprise white areas and black areas which are opposite numbers, and the black areas are rectangular areas at least containing one corner of the masks.
In a third aspect, an embodiment of the present invention further provides a tumor identification system, where the system includes:
one or more processors;
storage means for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to perform the steps of:
acquiring a gray level pathological image of a pathological section;
controlling at least two masks with different scales to move on the gray pathological image pixel by pixel, calculating a characteristic value corresponding to each movement result, and splicing all characteristic values corresponding to each mask together to form a characteristic vector for expressing the structural characteristics of the gray pathological image; the mask comprises a white area and a black area which are opposite in number, and the black area is a rectangular area at least comprising one corner of the mask;
and determining a tumor identification result according to the feature vector.
Further, the device also comprises a microscope and an output device;
the microscope is used for collecting color pathological images of pathological sections based on a preset magnification factor and a preset resolution;
the processor is further configured to output the lesion recognition result to the output device for viewing by a user.
In a fourth aspect, an embodiment of the present invention further provides a storage medium containing computer-executable instructions, which when executed by a computer processor, perform the image feature extraction method according to the first aspect, or perform a tumor identification step, where the tumor identification step includes:
acquiring a gray level pathological image of a pathological section;
controlling at least two masks with different scales to move on the gray pathological image pixel by pixel, calculating a characteristic value corresponding to each movement result, and splicing all the characteristic values corresponding to each mask together to form a characteristic vector for expressing the structural characteristics of the gray pathological image; the mask comprises a white area and a black area which are opposite in number, and the black area is a rectangular area at least comprising one corner of the mask;
and determining a tumor identification result according to the feature vector.
The technical scheme of the image feature extraction method provided by the embodiment of the invention comprises the following steps: acquiring a gray level pathological image of a pathological section; controlling at least two masks with different scales to move on a gray pathological image pixel by pixel, calculating a characteristic value corresponding to each movement result, and splicing all the characteristic values corresponding to each mask together to form a characteristic vector for representing the structural characteristics of the gray pathological image, wherein the masks comprise white areas and black areas which are opposite in number, and the black areas are rectangular areas at least containing one corner of the masks. By obtaining the characteristic value of the overlapped part of each mask and the gray pathological image, the structured characteristic of the gray pathological image is extracted by taking the mask as a unit, and the structured characteristic contains regional difference information of the gray pathological image, so that the tumor identification accuracy of the tumor identification model is improved.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described through embodiments with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example one
Fig. 1 is a flowchart of an image feature extraction method according to an embodiment of the present invention. The technical scheme of the embodiment is suitable for the condition of automatically identifying the tumor according to the pathological image. The method can be executed by the image feature extraction device provided by the embodiment of the invention, and the device can be realized in a software and/or hardware manner and is configured to be applied in a processor. The method specifically comprises the following steps:
s101, gray-level pathological images of pathological sections are obtained.
Among them, the image of the physiological slice collected by the medical microscope is usually a color pathological image. And if the resolution of each acquired color pathological image is the same, directly converting the acquired color pathological images into gray pathological images. And if the resolution ratios of the acquired color pathological images are different, converting the acquired color pathological images into gray pathological images with the same resolution ratio. It can be understood that when physiological slice images with different resolutions are converted into gray pathological images with the same resolution, color pathological images with different resolutions can be converted into color pathological images with the same resolution, and then the color pathological images with uniform resolution can be converted into gray pathological images; or the color pathological images with different resolutions can be converted into gray pathological images respectively, and then the resolutions of the generated gray pathological images are unified to the same resolution.
S102, controlling at least two masks with different scales to move on the gray pathological image pixel by pixel, calculating a characteristic value corresponding to each movement result, and splicing all the characteristic values corresponding to each mask together to form a characteristic vector for representing the structured characteristic of the gray pathological image, wherein the masks comprise white areas and black areas which are opposite in number, and the black areas are rectangular areas at least containing one corner of the masks.
After the gray pathological image is obtained, controlling at least two masks with different scales to move on the gray pathological image pixel by pixel, calculating the sum of pixel gray values of the covering area of the mask on the gray pathological image at the end of each movement to serve as a feature value of the current movement, taking all feature values corresponding to each mask as feature vectors corresponding to the masks and used for representing the structured features of the gray pathological image, and splicing the feature vectors corresponding to each mask together to form the feature vector used for representing the structured features of the gray pathological image. It will be understood that the information features carried by the feature vectors corresponding to all masks are the same as the information features carried by the feature vectors formed by stitching together the feature vectors of all masks.
The method for moving the mask on the gray pathological image comprises the steps of enabling an upper left corner element of the mask to coincide with an upper left corner pixel of the gray pathological image, controlling the mask to move to the right pixel by pixel on the gray pathological image until the upper right corner element of the mask coincides with the upper right corner element of the gray pathological image, controlling the upper left corner element of the mask to move to the position of a first pixel of a second line of the gray pathological image, controlling the mask to move to the right pixel by pixel until the upper right corner element of the mask coincides with a last element of the second line of the gray pathological image, and controlling the mask to move in an S shape until the lower right corner element of the mask coincides with the lower right corner pixel of the gray pathological image. It should be noted that the present embodiment specifically limits the movement manner of the mask as long as the mask is made to traverse all pixels of the grayscale pathology image.
The number of the masks in this embodiment is preferably greater than or equal to three, each mask includes a black area and a white area, which are opposite to each other, the black area is less than or equal to the white area, and the black area at least includes a rectangular area at one corner of the mask, for example, the black area is 1/2, 1/4, 1/8, etc. of the mask. Preferably, the black area is 1/4 of the mask, each element of which is-1, and the white area is the remaining 3/4 of which each element of which is 1, as shown in fig. 2A and 2B. In order to increase the extraction speed of the feature vector, the present embodiment preferably uses masks of 2 × 2, 4 × 4, and 8 × 8 sizes, and the black area of each mask is an area 1/4 of the upper right corner of the mask.
The characteristic value of each movement result of the mask on the gray pathological image is as follows: f. of i =sum(M×Gray i ) Wherein f is i Features corresponding to the ith movement of the current mask on the gray-scale pathological imageAnd the eigenvalue, M is a coefficient matrix of the mask, and Grayi is a gray value matrix of the coverage area of the current mask on the gray pathological image.
Preferably, in order to increase the calculation speed of the feature vector, in this embodiment, an integral map of the gray-scale pathology image is first obtained, then at least two masks with different scales are controlled to move on the integral map pixel by pixel, a feature value corresponding to each movement is calculated, and all feature values corresponding to each mask are taken as the feature vector of the mask. Each pixel point of the integral graph is the sum of gray values of all pixel points in a rectangular area surrounded by an upper left corner pixel point of the gray pathological image and each target pixel point, and the sum is specifically as follows:
wherein i (x ', y') is the gray value of the pixel point with the coordinate (x ', y'), and (x, y) is the coordinate of the target pixel point.
After the integral graph is determined, any rectangular mask located at any position of the integral graph can obtain the characteristic value of the rectangular mask through a table look-up method and limited simple operation, and the operation amount of obtaining the characteristic value corresponding to each mask is greatly reduced. As shown in fig. 3:
the integral of point 1 is S1= Sum (Ra);
the integral at point 2 is S2= Sum (Ra) + Sum (Rb);
the integral at point 3 is S3= Sum (Ra) + Sum (Rc);
the integral at point 4 is S4= Sum (Ra) + Sum (Rb) -Sum (Rc) -Sum (Rd);
the sum (integral) of the pixel values of all points in the region Rd can be expressed as:
Sum(Rd)=S1+S4-S2-S3
therefore, no matter how large the size of the rectangle Rd is, the sum (integral) of the pixel gray values of the Rd can be obtained by searching the integral graph for 4 times at most, the operation speed is high, and the extraction speed of the feature vector is greatly improved.
The technical scheme of the image feature extraction method provided by the embodiment of the invention comprises the following steps: acquiring a gray level pathological image of a pathological section; controlling at least two masks with different scales to move on a gray pathological image pixel by pixel, calculating a characteristic value corresponding to each movement result, and splicing all the characteristic values corresponding to each mask together to form a characteristic vector for representing the structural characteristics of the gray pathological image, wherein the masks comprise white areas and black areas which are opposite in number, and the black areas are rectangular areas at least containing one corner of the masks. By obtaining the characteristic value of the overlapped part of each mask and the gray pathological image, the structured characteristic of the gray pathological image is extracted by taking the mask as a unit, and the structured characteristic contains regional difference information of the gray pathological image, so that the tumor identification accuracy of the tumor identification model is improved.
Example two
Fig. 4 is a block diagram of an image feature extraction device according to a second embodiment of the present invention. The device is used for executing the image feature extraction method provided by any of the above embodiments, and the device can be implemented by software or hardware. The device includes:
the acquisition module 11 is used for acquiring a gray level pathological image of a pathological section;
the feature vector module 12 is configured to control at least two masks with different scales to move on the grayscale pathology image pixel by pixel, calculate a feature value corresponding to each movement result, and splice all feature values corresponding to each mask together to form a feature vector for representing the structured feature of the grayscale pathology image, where the mask includes a white region and a black region that are opposite numbers to each other, and the black region is a rectangular region that at least includes one corner of the mask.
Optionally, the obtaining module is configured to convert at least two color pathology images of a same pathology section with different resolutions into a grayscale pathology image with a same resolution.
Optionally, the feature vector module is configured to control at least two masks with different scales to move pixel by pixel on an integral graph corresponding to the grayscale pathological image, calculate a feature value corresponding to a result of each movement, and use all feature values corresponding to each mask as a feature vector corresponding to the mask, where each pixel point of the integral graph is a sum of grayscale values of all pixel points in a rectangular region surrounded by an upper left-corner pixel point of the grayscale pathological image and each target pixel point, and specifically:
wherein i (x ', y') is the gray value of the pixel point with the coordinate (x ', y'), and (x, y) is the coordinate of the target pixel point.
Wherein, the characteristic value corresponding to each moving result is:
f i =sum(M×Gray i )
wherein, f i And M is a coefficient matrix of the mask, and Grayi is a gray value matrix of a coverage area of the current mask on the integral graph.
According to the technical scheme of the image feature extraction device, the gray level pathological image of the pathological section is obtained through the obtaining module; the method comprises the steps of controlling at least two masks with different scales to move on a gray pathological image pixel by pixel through a feature vector module, calculating feature values corresponding to each movement result, and splicing all feature values corresponding to each mask together to form a feature vector for expressing the structured features of the gray pathological image. By obtaining the characteristic value of the overlapped part of each mask and the gray pathological image, the structured characteristic of the gray pathological image is extracted by taking the mask as a unit, and the structured characteristic contains regional difference information of the gray pathological image, so that the tumor identification accuracy of the tumor identification model is improved.
The image feature extraction device provided by the embodiment of the invention can execute the image feature extraction method provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method.
EXAMPLE III
Fig. 5 is a schematic structural diagram of a tumor identification system according to a third embodiment of the present invention, as shown in fig. 5, the system includes a processor 201 and a memory 202; the number of the processors 201 in the system may be one or more, and one processor 201 is taken as an example in fig. 5; the processor 201 and the memory 202 in the system may be connected by a bus or other means, and fig. 5 illustrates the connection by the bus as an example.
The memory 202, which is a computer-readable storage medium, may be used to store software programs, computer-executable programs, and modules. The processor 201 executes various functional applications and data processing of the device by running software programs, instructions and modules stored in the memory 202, i.e. implementing the following methods:
acquiring a gray pathological image of a pathological section; controlling at least two masks with different scales to move on a gray pathological image pixel by pixel, calculating a characteristic value corresponding to each movement result, and splicing all the characteristic values corresponding to each mask together to form a characteristic vector for expressing the structural characteristics of the gray pathological image; the mask comprises a white area and a black area which are opposite in number, and the black area is a rectangular area at least comprising one corner of the mask; and determining a tumor identification result according to the feature vector.
The memory 202 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the memory 202 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, the memory 202 may further include memory located remotely from the processor 201, which may be connected to the device over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
As shown in fig. 6, the system further includes an output device 204, and the output device 204 may include a display device such as a display screen, for example, a display screen of a user terminal.
Preferably, the system further comprises a microscope 205, the microscope 205 being adapted to acquire a color pathology image of the pathology section at a preset resolution based on a preset magnification. The processor is also used for controlling the output device to output the color pathological image, or output a tumor recognition result, or output an intermediate result in the tumor recognition process, such as a gray pathological image.
The system also preferably includes an input device 203, the input device 203 being operable to receive entered numeric or character information and to generate key signal inputs relating to user settings and function controls of the apparatus.
Preferably, after obtaining the feature vector corresponding to each mask, the processor concatenates the feature vectors corresponding to each mask together to form a feature vector for representing the structural features of the gray-scale pathology image, then inputs the feature vector into the trained tumor recognition model to obtain a tumor recognition result, and outputs the tumor recognition result to the output device for clinical diagnosis reference of the doctor.
Example four
An embodiment of the present invention further provides a storage medium containing computer-executable instructions, which when executed by a computer processor, perform an image feature extraction method, including:
acquiring a gray level pathological image of a pathological section;
controlling at least two masks with different scales to move on the gray pathological image pixel by pixel, calculating a characteristic value corresponding to each movement result, and splicing all characteristic values corresponding to each mask together to form a characteristic vector for expressing the structural characteristics of the gray pathological image; the mask comprises a white area and a black area which are opposite, and the black area is a rectangular area at least comprising one corner of the mask.
Or performing a tumor identification step comprising:
acquiring a gray pathological image of a pathological section;
controlling at least two masks with different scales to move on the gray pathological image pixel by pixel, calculating a characteristic value corresponding to each movement result, and splicing all the characteristic values corresponding to each mask together to form a characteristic vector for expressing the structural characteristics of the gray pathological image; the mask comprises a white area and a black area which are opposite, and the black area is a rectangular area at least comprising one corner of the mask.
And determining a tumor identification result according to the feature vector.
Of course, the storage medium containing the computer-executable instructions provided by the embodiments of the present invention is not limited to the method operations described above, and may also perform related operations in the image feature extraction method provided by any embodiment of the present invention.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which may be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device) to execute the image feature extraction method according to the embodiments of the present invention.
It should be noted that, in the embodiment of the image feature extraction apparatus, the included units and modules are only divided according to functional logic, but are not limited to the above division as long as the corresponding functions can be realized; in addition, the specific names of the functional units are only for the convenience of distinguishing from each other, and are not used for limiting the protection scope of the present invention.
It is to be noted that the foregoing description is only exemplary of the invention and that the principles of the technology may be employed. Those skilled in the art will appreciate that the present invention is not limited to the particular embodiments described herein, and that various obvious changes, rearrangements and substitutions will now be apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.