Method and device for fast image palette extraction based on neural network

By using a neural network-based method, image palettes are generated using convolutional and fully connected layers, solving the problems of slow extraction speed and insufficient accuracy of large images in existing technologies. This achieves fast and accurate image palette extraction, applicable to images with various color richness levels.

CN115346052BActive Publication Date: 2026-03-24HANGZHOU LEXIN SHENGWEN TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-22
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

Existing image palette extraction methods are slow on large images and cannot accurately describe color distribution, especially for images with different levels of color richness.

Method used

A neural network-based approach is adopted, which converts image data into LAB format, inputs it into multiple cascaded convolutional layers for feature extraction, and then generates palette features through fully connected layers. The network parameters are optimized by combining the target loss function and training the convolutional neural network, and the number and quantity of colors are adjusted after the palette is generated.

Benefits of technology

It achieves fast and accurate image palette extraction, applicable to images with varying degrees of color richness, and can describe the color distribution in an image in real time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115346052B_ABST
    Figure CN115346052B_ABST
Patent Text Reader

Abstract

The application provides a neural network-based image palette fast extraction method and device, which comprises the following steps: obtaining LAB format data of an image to be extracted; inputting the obtained LAB format data into a plurality of cascaded group convolution layers to obtain a plurality of feature maps for describing the features of the LAB format data; inputting the plurality of feature maps into a full connection layer to obtain a palette feature classification result of the image; and generating a palette corresponding to the LAB format data based on the obtained palette feature classification result. The image palette fast extraction method can accurately describe the color distribution in the image to be recognized.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, in particular to a method and device for quickly extracting image palette based on neural network. BACKGROUND

[0002] In the field of image editing, image recoloring and other image processing, palette is often used; palette is also called color table or color chart, which represents the main colors in the image; palette provides a simple method to reduce the number of colors needed to express a picture; and by modifying the palette, combined with layer decomposition, recoloring and other techniques, various image editing tasks can be completed.

[0003] The existing technology for extracting palette from image mainly adopts clustering method, such as k-means algorithm; k-means algorithm specifies K value to cluster the color number of the whole image into K classes, and takes the class center of K classes as the color of the palette. Although the clustering method currently adopted can complete the extraction of image palette, if the image is large, the speed of extracting palette from the large image by using clustering algorithm will be very slow; secondly, since different images have different color richness, and the clustering algorithm needs to specify K value in advance, therefore, the generated palette often cannot accurately describe the color distribution in images with different color richness. Therefore, how to provide an image palette extraction method to accurately describe the color distribution in the image is a technical problem to be solved. SUMMARY

[0004] Therefore, the present application provides a method and device for quickly extracting image palette based on neural network to solve one or more problems in the prior art.

[0005] According to one aspect of the present application, a method for quickly extracting image palette based on neural network is disclosed, which comprises:

[0006] obtaining LAB format data of an image whose palette is to be extracted;

[0007] inputting the obtained LAB format data into a plurality of cascaded convolution layer groups to obtain a plurality of feature maps for expressing the features of the LAB format data;

[0008] inputting the plurality of feature maps into a fully connected layer to obtain a palette feature classification result of the image;

[0009] generating a palette corresponding to the LAB format data based on the obtained palette feature classification result.

[0010] In some embodiments of the present application, the LAB format data of the image whose palette is to be extracted is obtained, comprising:

[0011] obtaining an image to be identified for extracting a palette, scaling the image to be identified to a preset pixel size, converting the image to be identified scaled to the preset pixel size into a LAB color space, and normalizing values of each channel of the image to be identified in the LAB color space.

[0012] In some embodiments of the present application, the method further comprises training a convolutional neural network comprising the group of convolutional layers and the fully connected layer to optimize network parameters of the convolutional neural network.

[0013] In some embodiments of the present application, training the convolutional neural network model comprising the group of convolutional layers and the fully connected layer comprises:

[0014] obtaining a training sample set comprising a plurality of sample data;

[0015] determining a target loss function for constraining the fully connected layer;

[0016] inputting the sample data in the training sample set into the convolutional neural network model for training.

[0017] In some embodiments of the present application, the target loss function is:

[0018]

[0019] wherein L represents a loss value, N represents a pixel size of the scaled image to be identified, I P represents the i-th pixel point of the scaled image to be identified, and p' represents a color on the generated palette closest to the i-th pixel point. i

[0020] In some embodiments of the present application, the method further comprises:

[0021] obtaining each pixel point of an image to be identified for extracting a palette;

[0022] determining a number of colors on the generated palette similar to a color of each of the pixel points;

[0023] in a case where the number of colors is less than a preset threshold, deleting the corresponding color on the palette.

[0024] In some embodiments of the present application, the group of convolutional layers comprises seven group convolutional layers, and each of the group convolutional layers comprises two convolutional layers; and / or

[0025] inputting the plurality of feature maps into a fully connected layer to obtain a palette feature classification result of the image, comprising: ​

[0026] inputting the plurality of feature maps into a full connection layer, the full connection layer converting the plurality of feature maps into K * 3-dimensional features.

[0027] In some embodiments of the present application, the convolution kernel size of each of the convolution layers is 3 * 3, and the number of feature maps output by the seven group convolution layers is 8, 16, 32, 64, 128, 256 and 256 respectively.

[0028] According to another aspect of the present application, there is also disclosed a neural network-based image palette fast extraction system, comprising a processor and a memory, the memory storing computer instructions, the processor being configured to execute the computer instructions stored in the memory, and the system implementing the steps of the method according to any one of the above embodiments when the computer instructions are executed by the processor.

[0029] According to still another aspect of the present application, there is also disclosed a computer readable storage medium storing a computer program, the program being executed by a processor to implement the steps of the method according to any one of the above embodiments.

[0030] The neural network-based image palette fast extraction method and device disclosed in the present application can obtain a plurality of feature maps by inputting LAB format data of an image to be recognized into a cascade of convolution layers, and then input the plurality of feature maps obtained into a full connection layer, and further generate a palette of the image to be recognized based on the output of the full connection layer. The algorithm speed of the method is not affected by the size of the image, and the method based on the convolution neural network can accurately describe the color distribution in the image.

[0031] In addition to the above, the neural network-based image palette fast extraction method can delete colors on the palette whose number is less than a preset threshold, so that the image palette fast extraction method can be applied to images with different color richness, and can accurately and quickly express representative colors of images with different color richness.

[0032] Additional advantages, objects, and features of the application will be set forth in part by the description that follows, and will become apparent to those skilled in the art upon examination of the following or can be learned by practice of the application. The objects and other advantages of the application can be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.

[0033] It will be understood by those skilled in the art that the objects and advantages of the present application can be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings. Attached Figure Description

[0034] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, are not intended to limit the scope of the invention. The components in the drawings are not drawn to scale but are merely illustrative of the principles of the invention. For ease of illustration and description of certain parts of the invention, corresponding portions in the drawings may be enlarged, i.e., may appear larger relative to other components in an exemplary device actually manufactured according to the invention. In the drawings:

[0035] Figure 1 This is a flowchart illustrating a method for rapid image palette extraction based on neural networks according to an embodiment of the present invention.

[0036] Figure 2 This is a schematic diagram of the architecture of a neural network-based image palette fast extraction system according to an embodiment of the present invention.

[0037] Figure 3 This is a schematic diagram of the structure of a group of convolutional layers in a convolutional neural network according to an embodiment of the present invention.

[0038] Figure 4 A schematic diagram of the structure for pixel-level addition of the outputs of two convolutional layers.

[0039] Figure 5 This is a schematic diagram of the operation process of a fully connected layer.

[0040] Figure 6 For K * A flowchart illustrating the process of converting 3D feature representations into a palette containing K colors.

[0041] Figure 7 A comparison of color palettes generated for multiple images to be identified, each containing varying degrees of color richness. Detailed Implementation

[0042] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings. Here, the illustrative embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention.

[0043] It should be noted that, in order to avoid obscuring the invention with unnecessary details, only the structures and / or processing steps closely related to the solution according to the invention are shown in the accompanying drawings, while other details that are not closely related to the invention are omitted.

[0044] It should be emphasized that the term "including / comprises / has" as used herein refers to the presence of a feature, element, step, or component, but does not exclude the presence or addition of one or more other features, elements, steps, or components.

[0045] In order to solve the defects of low algorithm speed of large image and often unable to accurately describe the color distribution in the image of the prior art image palette extraction method, the application provides a new neural network-based image palette fast extraction method and device to more accurately extract the palette of the image to be recognized, and the algorithm speed of the image palette extraction method of the application is not affected by the size of the image, and the palette of the image can be extracted from the image to be recognized in real time and accurately, so as to more accurately describe the color distribution in the image.

[0046] Hereinafter, embodiments of the application will be described with reference to the accompanying drawings. In the drawings, the same reference numerals represent the same or similar components, or the same or similar steps.

[0047] Figure 1 The flowchart of the neural network-based image palette fast extraction method of an embodiment of the application is shown in FIG. 1, which comprises steps S10 to S40. Figure 1

[0048] Step S10: Obtain the LAB format data of the image whose palette is to be extracted.

[0049] In this step, the image whose palette is to be extracted is the image to be recognized, that is, the input image of the convolutional neural network of the application; when obtaining the LAB format data of the image whose palette is to be extracted, the obtained image to be recognized in RGB format can be converted into LAB format. The LAB color model is composed of luminosity (L) and three elements related to color, a and b. L represents luminosity, a represents the range from magenta to green, and b represents the range from yellow to blue. The LAB format data of the image whose palette is to be extracted is obtained in this step, so that the palette of the image can be recognized by the convolutional neural network model in the subsequent step to obtain a better recognition result.

[0050] ​Exemplarily, the LAB format data of the image to be extracted palette specifically comprises the following steps: obtaining the to-be-identified image of the to-be-extracted palette, scaling the to-be-identified image to a preset pixel size, converting the to-be-identified image scaled to the preset pixel size into a LAB color space, and normalizing the value of each channel of the to-be-identified image in the LAB color space. This process can also be understood as pre-processing the to-be-identified image to obtain the input data format required by the neural network-based image palette fast extraction system of the present application. In this embodiment, the to-be-identified image obtained first is generally an RGB image, and in order to more accurately extract the palette of the to-be-identified image, the RGB format image is further converted into a LAB expression format, so as to take the LAB format data of the to-be-identified image as input data.

[0051] Specifically, the to-be-identified image is scaled to a preset pixel size, that is, the to-be-identified image is scaled to an image with a size of N*N, and N is exemplarily 256, at this time the to-be-identified image is scaled to 256*256. The value of each channel of the to-be-identified image in the LAB color space is normalized, that is, each value is normalized to [0, 1]. In this step, the to-be-identified image as input data is first scaled to N*N size, then the scaled image is converted into a LAB color space expression, and finally normalized, that is, the input data is normalized to [0, 1].

[0052] Step S20: inputting the obtained LAB format data into a plurality of cascaded convolution layer groups to obtain a plurality of feature maps for expressing the features of the LAB format data.

[0053] In this step, the to-be-identified image is feature-extracted based on the convolution layer to obtain a plurality of feature maps for expressing the features of the LAB format data. The convolution layer group comprises a plurality of cascaded group convolution layers, Figure 3 The structure diagram of the group convolution layer of the convolutional neural network of an embodiment of the present application is shown in FIG. 2. Figure 3 Each group convolution layer comprises at least a plurality of convolution layers, and exemplarily, the size of the convolution kernel of each convolution layer is 3 * 3, and the step length of the convolution kernel sliding on the image is 1. Since the output size of the convolution layer is closely related to the selected window size, and after the convolution of the 3 * 3 convolution kernel, the output size of the convolution layer is reduced relative to the input size, so in order to keep the input and output sizes consistent, the input image is generally padded around. The padding method can be mirror padding or padding value 0. For example, first pad 1 row on each side of the input image, and then pad the input image with 1 row twice. *The convolution of 3 obtains a feature map; in addition, the input image directly undergoes a 3 * The convolution of 3 obtains another feature map, and the sizes of the two feature maps are consistent, so the two feature maps can be directly added.

[0054] Further, after the features of the input image are extracted based on the two convolution layers respectively, the outputs of the two convolution layers are further added at the pixel level, as shown in Figure 4 Figure 4 X is located in the feature image output by the first convolution layer, and Y is located in the feature image output by the second convolution layer, so that X i +Y i is located in the feature image obtained by adding the outputs of the first convolution layer and the second convolution layer at the pixel level. i i

[0055] In addition, the group convolution layer can also include an activation layer, which is responsible for activating the features of the to-be-recognized image extracted by the convolution layer. Since the convolution operation performs a corresponding linear transformation on the input image and the convolution kernel, an activation layer (nonlinear function) needs to be introduced for nonlinear mapping. The activation function can be a ReLU function, a Sigmoid function, a tanh function, etc. In an embodiment, the activation function is an LReLU (leaky rectified linear unit) function. The linear and non-saturated form of the LReLU function can quickly converge in SGD, and the LReLU function is faster than sigmoid and tanh in calculation.

[0056] The pooling layer is used for down-sampling the feature map to filter the features in the receptive field and extract the most representative features in the region, which can effectively reduce the output feature scale and further reduce the parameter amount required by the model. According to the operation type, the pooling operation can be divided into maximum pooling, average pooling and sum pooling, which respectively extract the maximum, average and sum feature values in the receptive field as the output. In a specific embodiment, the maximum pooling method is used to down-sample the feature map.

[0057] Step S30: inputting the plurality of feature maps into a fully connected layer to obtain a palette feature classification result of the image.

[0058] In this step, the plurality of feature maps output by the convolution layer group are further input into a fully connected layer. The fully connected layer plays a role of a classifier in the entire convolutional neural network. If the convolution layer, the pooling layer and the activation function layer and the like operations are to map the original data to the hidden layer feature space, the fully connected layer plays a role of mapping the learned "distributed feature representation" to the sample label space.

[0059] ​​​For example, inputting the plurality of feature maps into a fully connected layer to obtain the palette feature classification result of the image includes: inputting the plurality of feature maps into a fully connected layer, wherein the fully connected layer converts the plurality of feature maps into K values ​​representing the palette. * 3D features. Reference Figure 5 In this step, the multiple feature maps output by the convolutional layer group are transformed into K-maps representing the final palette through fully connected layer operations. * 3D features. The value of K can range from 5 to 15; in a specific example, K is 14. In this case, through a fully connected layer operation, the multiple feature maps output by the group of convolutional layers are converted into 14 representing the final color palette. * 3D features. It should be understood that K represents the number of color types in the final generated palette. A larger K value results in a larger number of colors in the palette. The value of K can be selected based on the actual application scenario, but it should also be noted that the value of K affects the palette extraction effect. The applicant found in their research that when based on a fully connected layer, converting to a 14-dimensional representation of the final palette... * When using 3D features, the color palette of the image to be identified can be extracted relatively well. However, when the K value is too large, the final extracted color palette may contain too many similar colors. When the K value is too small, the final generated color palette cannot accurately reflect the color distribution in the image, or it may lack some of the main colors in the image. Therefore, in order to avoid the above phenomena caused by K being too small or too large, the K value is best limited to 5 to 15, with 14 being the preferred K value.

[0060] In one embodiment, the number of feature images output by the convolutional layer group is 256. These 256 feature images are then passed through a fully connected layer to convert them into 14 images representing the final color palette. * 3D features.

[0061] Step S40: Generate a palette corresponding to the LAB format data based on the obtained palette feature classification results.

[0062] This step involves dimension adjustment, adjusting the K output of the fully connected layer. * The 3D feature is represented as a color palette containing K colors. When the fully connected layer outputs 14... * When using 3D features, then based on these 14... * The 3D feature, after dimensionality transformation, represents 14 colors in the corresponding color palette. (Reference) Figure 6 (R1,G1,B1) is represented as color C1 on the palette, while (R k G k B k ) is then represented as C on the color palette. k color.

[0063] Through the above steps, it can be found that by converting the to-be-identified image into LAB format data and inputting into the convolution layer group, and then inputting the multiple feature images output by the convolution layer group into the full connection layer, the full connection layer further represents the feature images as K * 3-dimensional features, and then represents the K * 3-dimensional features as a palette containing K colors. Thus, the extraction of the palette of the to-be-identified image is completed.

[0064] In another embodiment of the present application, the neural network-based image palette fast extraction method further comprises the following steps: training the convolutional neural network containing the convolution layer group and the full connection layer to optimize the network parameters of the convolutional neural network.

[0065] For example, the convolutional neural network model containing the convolution layer group and the full connection layer is trained, including: obtaining a training sample set, the training sample set including multiple sample data; determining a target loss function for constraining the full connection layer; and inputting the sample data in the training sample set into the convolutional neural network model for training. In this embodiment, more than 10,000 images with an initial resolution size of 2048*2048 can be selected to generate the training sample set, and at this time, the sample data includes the selected images and K * 3-dimensional features for representing the palette of the images, the sample data in the training sample set including images of multiple styles such as photography, oil painting, color drawing, and watercolor, the training being performed for about 600,000 rounds, and the learning rate being set to 0.0001. Before the training, first, the images with a resolution size of 2048*2048 are scaled into images with a resolution size of 256*256 pixels, and the images with a resolution size of 256*256 pixels are converted into LAB color space.

[0066] For example, when training the model, specifically, the loss L P is calculated in the full connection layer, and the target loss function used when calculating the loss is:

[0067]

[0068] wherein, L P represents the loss value, N represents the pixel size of the scaled to-be-identified image, I i represents the i-th pixel point of the scaled to-be-identified image, and p' represents the color on the generated palette closest to the i-th pixel point.

[0069] In addition, in order to make the color richness of the to-be-identified image different, obtain a palette containing different color quantities, that is, the color quantity on the generated palette is adapted to the input image, the neural network-based image palette fast extraction method of the present application further comprises the step of adjusting the size of the generated palette. Because in the above step, for the to-be-identified images with different color richness, the K * 3-dimensional features obtained by sequentially passing through the convolutional layer group and the full connection layer as input images are all used to represent the K

[0070] Specifically, in the step of adjusting the size of the palette, first, the pixel points of the image to be extracted are obtained; the color quantity of the generated palette that is similar to the color of each pixel point is determined; and in the case that the color quantity is less than a preset threshold, the corresponding color on the palette is deleted. In the step of determining the color quantity of the generated palette that is similar to the color of each pixel point, first, each color on the palette is obtained, the distance between each color on the palette and the first pixel point on the to-be-identified image is calculated, when the calculated distance value is less than a preset value, it means that the first pixel point is similar to the corresponding color, the total quantity of the colors on the palette that are similar to the first pixel point is further calculated, and it is judged whether the total quantity of the colors is less than the preset threshold. When it is judged that the total quantity of the colors on the palette that are similar to the first pixel point and have a distance less than the preset value is less than the preset threshold, the corresponding color on the palette is deleted. The preset threshold can be taken as the ratio of N 2 and 10 2 , and N represents the pixel size of the scaled to-be-identified image.

[0071] The neural network-based image palette extraction method of the present invention adjusts the palette size through the aforementioned steps to ensure that images with significant color distribution differences have palettes of different sizes. Specifically, the palette size adjustment method ensures that images with rich colors display a wider variety of colors on their final palette, while images with fewer colors display fewer colors on their final palette. For example, an image containing only blue sky and white clouds, which only contains blue and white, will have its final palette display only these two colors after the palette size adjustment. Therefore, after the convolutional neural network model of the above embodiments of the present invention extracts the palette of the image to be identified, the further palette size adjustment step results in a final palette that more clearly represents the color distribution of the corresponding image.

[0072] For example, such as Figure 7 As shown, the three images are initially represented as a palette containing 13 colors. The output of the fully connected layer then represents the 13 colors of the palette for the corresponding image. * The three-dimensional features are further enhanced by a palette size adjustment step, resulting in a final palette with 2 colors generated from the first image (which only has two colors), 6 colors from the second image, and 7 colors from the third image. This demonstrates that adjusting the palette size adapts to the color richness of the image being identified, thus more accurately representing the color distribution within the image.

[0073] In one embodiment, the convolutional layer group includes seven groups of convolutional layers, each group of convolutional layers includes two convolutional layers, and the kernel size of each convolutional layer is 3. * 3. The stride is 1. The first group of convolutional layers outputs 8 feature maps, while the second group outputs 16 feature maps. In one embodiment, the number of feature maps output by the seven groups of convolutional layers are 8, 16, 32, 64, 128, 256, and 256, respectively. The LAB format data of the image to be recognized is then input into multiple cascaded convolutional layer groups to obtain 256 feature maps. These 256 feature maps are further processed through a fully connected operation to obtain K, used to represent the color palette. * 3D features.

[0074] Accordingly, the present invention also discloses a fast image palette extraction system based on neural networks. The system includes a processor and a memory. The memory stores computer instructions, and the processor is used to execute the computer instructions stored in the memory. When the computer instructions are executed by the processor, the system implements the steps of the method as described in any of the above embodiments.

[0075] Figure 2 The schematic diagram of the architecture of the image palette fast extraction system based on neural network according to an embodiment of the present application is shown in Figure 2 The image palette fast extraction system includes at least a convolutional neural network, and the convolutional neural network includes at least seven groups of convolutional layers and one group of fully connected layers. It should be understood that the group of convolutional layers is limited to seven groups of convolutional layers, and each group of convolutional layers includes two convolutional layers, which is an example. In other embodiments, it can also be adjusted according to actual needs.

[0076] It can be found from the above embodiments that the image palette fast extraction method and system based on neural network can quickly and accurately extract the palette of the image to be recognized. In addition, after the palette is initially generated, the size of the palette can be further adjusted, that is, some colors on the palette are deleted. Therefore, the method and system can be applied to images with different color richness, and have a wide range of adaptation.

[0077] In addition, the present application also discloses a computer readable storage medium, which stores a computer program. When the program is executed by a processor, the steps of the method according to any one of the above embodiments are implemented.

[0078] Those skilled in the art should understand that the exemplary components, systems and methods described in connection with the embodiments disclosed herein can be implemented in hardware, software, or a combination thereof. The choice of hardware or software implementation depends on the specific application and design constraints imposed on the technical solution. Skilled professionals can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a functional card, etc. When implemented in software, the elements of the present application are program or code segment used to perform the required tasks. The program or code segment can be stored in a machine readable medium or transmitted through a data signal carried in a carrier wave on a transmission medium or communication link. The "machine readable medium" can include any medium capable of storing or transmitting information. Examples of machine readable medium include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.

[0079] It is also to be noted that the examples mentioned in the present application describe some methods or systems based on a series of steps or devices. However, the present application is not limited to the order of the steps mentioned above, that is, the steps can be performed in the order mentioned in the examples, can be different from the order mentioned in the examples, or several steps can be performed simultaneously.

[0080] In the present application, the features described and / or exemplified for one embodiment can be used in the same way or in an analogous way in one or more other embodiments, and / or in combination with or instead of features of other embodiments.

[0081] The above only describes the preferred embodiments of the present application and is not intended to limit the present application. The embodiments of the present application can be variously changed and modified by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method for fast image palette extraction based on neural networks, characterized in that, The method includes: Obtain LAB format data of the image from which the color palette is to be extracted; The acquired LAB format data is input into multiple cascaded convolutional layers to obtain multiple feature maps that represent the features of the LAB format data. The multiple feature maps are input into a fully connected layer to obtain the palette feature classification result of the image; Generate a palette corresponding to the LAB format data based on the obtained palette feature classification results; Obtain each pixel of the image from which the color palette is to be extracted; Determine the number of colors in the generated color palette that are similar to the color of each pixel; If the number of colors is less than a preset threshold, the corresponding color on the color palette will be deleted.

2. The method for fast image palette extraction based on neural networks according to claim 1, characterized in that, Obtain the LAB format data of the image from which the color palette is to be extracted, including: The image to be identified is obtained, the image to be identified is scaled to a preset pixel size, the image to be identified scaled to the preset pixel size is converted to the LAB color space, and the value of each channel of the image to be identified in the LAB color space is normalized.

3. The method for rapid image palette extraction based on neural networks according to claim 2, characterized in that, The method further includes training a convolutional neural network containing the convolutional layer group and the fully connected layer to optimize the network parameters of the convolutional neural network.

4. The method for rapid image palette extraction based on neural networks according to claim 3, characterized in that, Training a convolutional neural network model containing the aforementioned convolutional layer group and fully connected layer includes: Obtain a training sample set, which includes multiple sample data; Determine the target loss function to constrain the fully connected layer; The sample data in the training sample set is input into the convolutional neural network model for training.

5. The method for fast image palette extraction based on neural networks according to claim 4, characterized in that, The target loss function is: in, Represents the loss value. This represents the pixel size of the scaled image to be recognized. The first image to be identified represents the scaled image. 1 pixel This indicates that the color in the generated palette is related to the first... The color closest to each pixel.

6. The method for rapid image palette extraction based on neural networks according to any one of claims 1 to 5, characterized in that, The convolutional layer group comprises seven groups of convolutional layers, and each group of convolutional layers comprises two convolutional layers; and / or The multiple feature maps are input into a fully connected layer to obtain the palette feature classification results of the image, including: The multiple feature maps are input into a fully connected layer, which converts the multiple feature maps into K*3-dimensional features representing the palette.

7. The method for fast image palette extraction based on neural networks according to claim 6, characterized in that, The kernel size of each convolutional layer is 3*3, the stride is 1, and the number of feature maps output by the seven groups of convolutional layers are 8, 16, 32, 64, 128, 256 and 256, respectively.

8. A neural network-based image palette fast extraction system, the system comprising a processor and a memory, characterized in that, The memory stores computer instructions, and the processor executes the computer instructions stored in the memory. When the computer instructions are executed by the processor, the system implements the steps of the method as described in any one of claims 1 to 7.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the steps of the method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Methods, systems, and media for color palette extraction for video content items

    CN108737851A