# Image Color Recognition and Optimization Based on Deep Learning

Authors: Peng Li
Journal: Wireless Communications and Mobile Computing
 (2022)

---

## Abstract

In order to solve the problem of image color recognition, this paper proposes a method of image color recognition and optimization based on deep learning and designs a postprocessing framework based on word bag model (bow). The framework uses CNN features and calculates feature similarity. The image sets with high similarity are input into the image classifier trained by bow clustering model as the preliminary retrieval results. The retrieval results are the categories with the largest number of images. The experimental results show that the image retrieval accuracy of the framework is 90.4% based on the same data set and classification category, which is 10% higher than the image retrieval algorithm based on CNN features.Conclusion. The color matching degree between the image color and the image to be retrieved has been greatly improved.


---

## Body

## 1. Introduction

With the extensive use of mobile electronic devices such as mobile phones and cameras in people’s lives, individuals produce a large number of multimedia information such as images and videos, as shown in Figure1. At the same time, with the popularity of the Internet and the rise of Internet industries such as social networks and online news, multimedia information such as images and videos uploaded on the network is growing in large numbers every day. People express event information, personal emotions, news trends, etc., through images on media networks and social platforms. These information is also disseminated on the network with the publisher. This indirect emotional expression of users has become an emotional situation in the network over time. The information in the network includes text, image, video, and other modes. As the saying goes, “a picture is worth a thousand words” as an important information carrier, images can express rich information. Image emotion analysis is an important part of network emotion analysis. It is a complex process how to catch this dynamic emotion change through images in the network, which is closely related to image retrieval, image semantic analysis, and other research fields.Figure 1
Image color recognition.


## 2. Literature Review

Chen et al. said that image recognition technology is of great significance. As 80% of the information sources for human beings to understand the external world, images show the importance of visual technology [1]. Zhang et al. said that due to the early emergence of term-based text recognition, the traditional image recognition system is based on image text identification, that is, an image is described by text information such as title, time, and environment [2]. Gu et al. said that when image recognition is carried out, text matching is used for recognition. When the number of images in the database is small, this method based on text matching can indeed play a better recognition effect [3]. Li and Matthews said that in view of the massive data in the Internet today, if the text is manually marked, it will not only waste a lot of manpower and time, but also different people may have different understanding of the image in different environments, so the marked text will naturally be different, resulting in a sharp drop in image recognition accuracy [4]. In view of this, the recognition algorithm based on image content and its own characteristics came into being. First, the image features were extracted, and then, the image retrieval or classification was carried out based on the image features. Yu et al. said that in 1999, the world’s first image content-based search engine was launched, filling the gap in the field of image search and creating a new era of “searching for images by images” [5]. Wang et al. said that algorithms such as feature extraction methods, feature-based classifiers, and cross domain integration with deep learning disciplines are emerging in endlessly, which has continuously improved the efficiency and accuracy of image recognition. Therefore, we see that this technology has played an important role in more and more fields. In the early days, people proposed text-based image retrieval (TBIR) [6]. Chakraborty et al. said that under the action of computer vision and database system, TBIR describes pictures subjectively by users and uses this text information to build a database search system. This text information comes from people’s cognitive division of things in images [7]. Al Sharfaa et al. said that today’s mainstream search engines, such as Google and Baidu, still manage image data in the database in this way [8]. Zhao et al. said that however, with the sharp increase in the number of image data, the TBIR system has many problems [9] according to the actual use of users. First of all, Fischer and Milford said that the text information of the image is annotated by the user. Different people have different understanding of the image, and the environment and focus on the image when uploading the image are also different. It is difficult to obtain the information with strong personal opinions by the public [10]. Secondly, image annotation needs a lot of labor time and cost. At the same time, a considerable part of the text information does not conform to the actual content of the image, because of the inaccuracy of manual annotation. Traditional image classification and image retrieval algorithms mainly rely on text information for operation and rarely involve the research on the retrieval function of multimedia information. One of the most important reasons is that the operability of multimedia information features is far lower than that of text information. On the other hand, the multimedia information search system, which started late, is relatively immature and imperfect. Especially in recent years, with the rapid development of search engine technology, network technology, and multimedia technology, a single form of search engine retrieval information can no longer meet the needs of users, and the diversification of forms has become an irresistible trend.


## 3. Method

As CBIR (content-based image retrieval) cannot meet people’s needs for image retrieval in some application scenarios or performance, extracting image features through machine learning has become a hot spot in the field of image retrieval in various countries, especially CNN (convolutional neural network) has made great progress in the field of image recognition [11, 12]. Although CNN has greatly improved the accuracy of image retrieval or classification based on traditional visual features, it is not sensitive to image color, brightness, and other features. The algorithm in this paper combines CNN abstract semantic features with traditional image visual features to make up for the lack of a single feature, so as to improve the accuracy of image retrieval. Neuron is also a kind of cell, which is composed of nucleus, cytoplasm, and cell membrane. Different from ordinary cells, it also contains many processes, including axons, dendrites, and cell bodies. In the cell body, the nucleus, dendrites, and axons, respectively, play the role of information input and output. For a neuron, there can be many dendrites, but axons are unique. That is to say, a neuron has n inputs through multiple dendrites, processes information through the cell body, and finally outputs the processed information by an axon. Neurons are connected through axons and dendrites of the next neuron, so a mathematical model is abstracted, as shown in Figure 2.Figure 2
Neuron abstract mathematical model.The data operation of the middle circular region simulates the nuclear information processing,x1,x2,⋯xn, represent N inputs of dendrites, and 0j represents the output of axons [13]. External information is input through the dendrites of neurons, then enters the nucleus for information processing, and finally outputs the information to other neurons through the axons. Therefore, the characteristics of this algorithm are similar to the learning process of human brain. When there is information input from the outside, the system will adjust parameters adaptively according to different stimuli. For example, through continuous training, human beings have learned to swim, and through continuous training, they have mastered the skills of driving. The essence of mastering these skills is formed by training tens of billions of neurons, and the accumulation of these behaviors is the final result orientation. By training x1,x2,⋯xn, the neural network algorithm continuously adjusts the system parameters and finally forms a correct result orientation by using a certain number of training samples. After this process, the system will have the ability to learn, and the similar inputs will get the corresponding output. Because the brain nervous system is very complex, the algorithm only introduces some basic characteristics of the brain, which cannot represent a complete and realistic biological system, but a simple imitation and abstract process. The algorithm is different from the conventional mathematical calculation. It does not need to perform operations step by step. It can summarize the laws, adapt to the environment, and complete some control and identification tasks. This is the idea of artificial intelligence. The basic model of artificial neural network is shown in Figure 3.Figure 3
Artificial neural network model.LayerL1 is the input layer, which contains the input attribute values and probabilities in the data mining model. Layer L2 is the hidden layer, the input data is the output of the previous neuron, and the output data is the input of the next neuron. The hidden layer assigns weights to each input data. The larger the weight, the higher the correlation between the input and hidden neurons. A negative weight indicates that the input suppresses a specific result. The process of assigning weights is the process of neural network learning. Layer L3 is the output layer, which represents the final predicted attribute value, that is, the learning result. The hidden layer in each neuron is an extreme unit, which can be expressed by different nonlinear functions. These functions are very similar to the transmission characteristics of neural networks in biology and are called activation functions. That is, a small change in input value may lead to a large change in output. For example, the activation function of Microsoft neural network algorithm is shown in the following formulas:
(1)Sigmoid:O=11+e−a,(2)Tanh:O=ea−e−aea+e−a,wherea is the input data of neuron and O is the output value. However, when the output of a node is different from the expectation, the neural network will adaptively adjust the “trust” degree of the latter layer node to the former layer node, that is, adjust the weight of the connection between the two layers of nodes. The method of reducing the weight is used to punish the nodes that cause output errors, and at the same time, the weight of those nodes that play an active role in guiding is increased. Since there are multiple layers of input data, the wrong node should be punished accordingly until the input node. This adaptive way of adjusting parameters is called feedback. The formula used to calculate the error and adaptively adjust the weight is shown a follows:
(3)Erri=Oi∗1−Oi∗Ti−Oi,whereOi is the output of the i-th output neuron, Ti is the actual output value of the neuron based on the training sample, and the error of the hidden layer is calculated by combining the error of the neuron of the next layer with the corresponding weight. The calculation formula is shown as follows:
(4)Erri=Oi1−Oi∑jErrj∗wij,whereOi is the output of the i-th output neuron, which has j connections with the lower layer neurons, Errj is the error of the i-th output neuron, and wij is the weight between the two layers of neurons. The formula for adjusting the neuron connection weight wij through Erri is shown as follows:
(5)wij=wij+l∗Erri∗Oi,wherel is the learning function, and the range is 0 to 1.The bow model classifies images based on SIFT features. SIFT features not only have the advantages of displacement, scale, and deformation invariance, but also illumination invariance, that is, it still has good detection effect on similar images with large brightness difference, so it can make up for CNN’s insensitivity to illumination features. The SIFT feature extraction of images can be divided into the following four steps:Construct scale space. The main purpose is to describe the scale invariant characteristics of images. The definition of image scale space is shown in the following formulas:(6)Lx,y,σ=Gx,y,σ∗Ix,y,(7)Gx,y,σ=12πσ2e−x2+y2/σ2,wherex and y are the spatial coordinates of image pixels, the size of σ determines the degree of image smoothing, and Ix,y is the pixel value of the image at x and y. In order to make the feature of key points extracted more stable, Gaussian difference scale space is introduced, as shown in the following formula:
(8)Dx,y,σ=Lx,y,kσ−Lx,y,σ.Establish an image gold tower. The images between towers are in a downsampling relationship. The image scale spaceσ is different between different layers in the same tower. For example, take σ,k,..⋯,knσ, respectively. The number of towers is determined by the image size, as shown in Figure 4.Figure 4
Image gold tower.Determine the position and scale of key points by fitting the three-dimensional quadratic function and remove the pixels with asymmetric local curvature, so as to improve the matching stability and enhance the antinoise ability. For example, Harris Corner detector is used, as shown in the following formula:(9)Dx=D+∂DT∂x+0.5xT∂2D∂x2x.Calculate the derivative of formula (9) and make it 0 to obtain the extreme point xΛ. If DxΛ≥0.03, keep the characteristic point; otherwise, discard it.


## 4. Experiment and Analysis

The semantic understanding of images includes two levels: cognitive level and emotional level. In the cognitive layer, people pay attention to what the image describes, such as cars, trees, and rivers, people generally have no objection to the description of this layer. The emotional level describes the emotion expressed by the image, such as whether the image is cool or not and whether the scenery in the image makes you feel peaceful [14, 15]. The research on image retrieval based on the emotion expressed by images has gradually been paid attention by researchers. It has many application scenarios. For example, a magazine editor will pay more attention to finding an image that is consistent with the article emotion as an illustration, without limiting the content [16]. There is a gap between the underlying features and this abstract emotional semantics. Aesthetic features build a bridge between image and emotion. Therefore, the emotional classification method based on aesthetic characteristics is gradually used by scholars. Color feature and texture information of perceptual level are proposed to train SVM classifier for emotion classification and polarity classification. The feature is expanded, not only using texture and other features, but also analyzing and proposing a variety of effective features from the perspective of human visual perception, such as brightness, saturation, colorfulness, colorname, depth of field, facial expression, and skin color, after extracting the features. SVM is also used to learn the emotion classifier. New features such as image symmetry and color gradient change are proposed. The classifiers are generally SVM classifiers, logistics progression, and other methods. The block diagram of these emotion classifiers based on aesthetic features is shown in Figure 5.Figure 5
Emotion classification based on aesthetic image.The image emotion classification method based on aesthetic features opens a door to visual emotion analysis and provides a practical direction. However, there are many kinds of aesthetic features, most of which are global features, and the information is simple and easy to ignore the semantic content of the image. If the images with the same aesthetic statistical characteristics describe different contents, the emotions expressed by the images are often different. These problems cannot be solved only based on the aesthetic characteristics [17, 18]. Generally speaking, the emotion classification method based on aesthetics needs to solve the problem of multifeature selection and deeper image semantic gap. Although the image emotion classification method based on aesthetic features and face detection has better performance than the underlying feature method, this feature is still not well described and has a certain generation gap for high-level semantic analysis. The original information in the image, such as address, task, time, and event, can implicitly describe the image, but not all images have this original information [19]. How to propose a feature with semantic description to solve this semantic gap? With the improvement of image classification, scene recognition, face detection, and other technologies, more and more network images and corresponding weak information participate in the construction of semantic ontology. We can use the existing object detection technology and massive images to build a large emotional semantic database and use concept detection technology to extract the semantic information described in the image, such as the local objects contained in the image, image scene description, and facial expression information. A large number of detectors constitute a rich semantic feature. These features can be easily understood by people and describe various information, which can better solve the problem of emotional semantic gap. We call this feature the middle layer feature [20]. The characteristics of the middle tier vary according to the application scenarios. The following two sections of this paper will briefly introduce the two middle tier feature attributes and emotion Semantic Ontology Applied in emotion semantic analysis. Emotion is a kind of abstract semantics. It is more difficult to distinguish the emotion in the image than the content in the image. The underlying features have been unable to describe this kind of emotional semantics. Using the semantic features of the middle layer can narrow the gap between them. However, an emotion has great differences among different objects, and different objects such as people and dogs may have this emotion of joy. However, the visual differences between people and dogs are too great, and one or a small amount of semantics have no direct connection with emotion. It provides a new idea to solve this problem. Since emotions have such great differences among different objects, it is better to build an emotional ontology for each object [21, 22]. How to construct this huge emotional ontology needs many problems to be solved. The first question is where the training images come from. With the enrichment of network images, more and more people share their own images and describe the images more or less. This weak information provides researchers with a large amount of training data. Researchers can collect the images and corresponding tag information of the desired objects on the network through search engines and screen the images that meet the standards through artificial emotional evaluation. The selection criterion is that there is strong emotional information, widely used in real life. Nowadays, the detection accuracy of the method is reliable [23]. Finally, 576 kinds of objects were selected as noun images, and the corresponding images were downloaded in the network to build an image library. The second problem to be solved is how to evaluate the emotion of each object. In the field of psychology, Plutchnik’s Wheel of Emotion measures human emotions into 24 categories, which are divided into 8 basic emotions and 3 different intensities. These 24 emotions are used to describe these images manually to form adjective emotional information [24, 25]. Such a noun adjective (ANP) pair emotion ontology training database based on object emotion is constructed. This ontology is called SentiBank. There are 47 K images and 1200 ANP pairs. The overall structure of SentiBank is a tree structure. All ANPs are aggregated in the form of groups, and different groups are independent of each other. This independence enables the object information of nouns to expand downward in a hierarchical manner, and the emotional information of the same object expands downward in a hierarchical manner, which is similar to the structure of Imagenet [26]. ArtPhoto mainly comes from online images. It uses human emotions as text and uses search engines to search for corresponding images on art image sharing websites. These pictures are published on the Internet by art lovers. At the same time, they give the observer an emotional impact from the perspective of art, such as image content composition, light, and color. ArtPhoto has 806 images in the whole database. Abstract is an abstract image library. Each image has only color, texture, and other structures and does not contain specific content. This database breaks away from the emotions expressed by the scenes and characters actually described by the images but stands on the level of artistic abstraction and brings emotional impact to people with simple colors and structures. This is very useful to verify the aesthetic characteristics of color, composition, light, and so on. In order to get the emotional labels corresponding to each image, the images in the database were investigated online. Volunteers selected the most suitable emotional labels for the images. 230 people voted for 280 images, 14 times for each image. The group with the highest voting score is the corresponding emotion label. At the same time, 228 ambiguous images were obtained. The detailed composition of image emotion database is shown in Table 1.Table 1
Detailed composition of image emotion database.
DatabaseHappyAngryAweSatisfyHatredExcitementFearFearTotalArtPhoto102701018075103103104805Abstract243167020353535218Total1247311715095138138139974For image features, we adopt the underlying visual features: LBP, BOW-SIFT, color histogram, and HOG features, the aesthetic-based visual features: photometric information, color information, and structure information, and the middle level semantic features: attribute-based middle level semantics and SentiBank features of noun adjective pairs. The description methods of these features are briefly introduced in this paper, thus forming four views. The current content-based image retrieval technology is mainly based on the underlying image features. If the retrieval is based on a variety of features, it only needs to give a certain proportion to each feature according to the impact of each feature on the retrieval effect and then integrate the feedback information of users during retrieval, and constantly adjust the proportion of each feature to achieve the best retrieval effect. However, no matter which of the three features is used, each feature has its own constraints. For example, the use of color features will lose the distribution of image color in the image position. The extraction algorithm of shape features is too complex, and there are still many problems to be solved. The use of texture features is affected by the image itself and external factors, so it is not universally applicable to image feature extraction. The combination of these three features or two features may be a feasible solution, but it still cannot solve the problem from the source, because color, shape, and texture are low-level features of the image, and they are still different from human visual features. Therefore, image retrieval will develop towards intelligent retrieval in the future, and the characteristics of deep learning neural network are just in line with the future development trend of image retrieval. This paper attempts to apply the depth convolution network model to image retrieval and compares the efficiency with the traditional image retrieval technology. Animal image retrieval based on color histogram features first needs to extract the color histogram from the image database and store the extracted color features, that is, to establish a feature database. In this way, when the image to be retrieved enters the system, it can return similar images only by comparing the image color features with the feature library, which can greatly improve the retrieval time. That when retrieving an image in the image database, taking the top 10 images as an example, the precision rate is 30% and the recall rate is 3%. For retrieval from images outside the database, there is only one similar image in the first 10 returned images, with a precision rate of 10% and a recall rate of 1%. Taking 15 returned images as the standard, the precision of image retrieval in the database is increased to 40%, and that outside the database is also increased by 10%, reaching 20%. The retrieval efficiency of image retrieval based on color features in this database is not high, mainly because the background and retrieval object colors of the image in this database are different, and the color histogram can only reflect the statistical distribution of the color but cannot reflect the spatial information of the color distribution of the image, so the retrieval efficiency is not high [27, 28]. By comparing the color histograms of the original image and the first similar image, it can be seen that although the color statistics of the two images are generally similar, the animals shown in the two images are very different. Therefore, for images with roughly similar colors, the efficiency of image retrieval based on color features is not high. The process of animal image retrieval based on SIFT features is similar to that based on color features. It also needs to extract SIFT features from the image database first. Since the similarity of images based on SIFT features is related to the number of matched SIFT feature points, the feature library contains the number and location of SIFT feature points of each image. When the image to be retrieved enters the system, it only needs to match the feature points of the image with the feature points in the feature library to return similar images. For the retrieval of - - images in the image database, take the return of the top 10 images as an example, and the number of returned similar images is 6, with a precision rate of 60% and a recall rate of 6%. For the retrieval of images outside the database, only four of the top 10 returned images are similar, with a precision rate of 40% and a recall rate of 4%. Taking 15 returned images as the standard, the precision of image retrieval in the database is increased to 66.67%, while that outside the database is reduced to 33.33%.


## 5. Conclusion

This paper studied a variety of image classification algorithms and image retrieval algorithms. On the basis of understanding the conventional methods of content-based image retrieval, we have proposed an image classification and image retrieval algorithm that combines the image features extracted by convolution neural network algorithm with the underlying visual features of the image. This method mainly uses the underlying visual features of the image, such as color features and local self-similarity features, to make up for the shortcomings of convolution neural network features, so as to improve the classification accuracy. The main work of this paper includes the following:In this paper, we use bow clustering model to postprocess the image retrieval results of convolution neural network algorithm to improve the accuracy of image retrieval. Although it is a cascade system, the two algorithms have a bias on the image features. It is found that the underlying visual features of the image SIFT features and convolution neural network features can make up for their respective shortcomings and improve the retrieval accuracy. In view of the fact that the image features extracted by convolution neural network algorithm are not sensitive to image color, an image retrieval algorithm based on the fusion of image features and color features is proposed. The weighted color square vector and color moment vector are spliced with the feature vectors extracted by convolution neural network algorithm to improve the color sensitivity of image retrieval algorithm. We combine the pHow features and local self-similar features of the image with the image features extracted by convolution neural network through multicore learning model to construct a composite kernel function. In the image classification algorithm, we no longer rely on individual features for classification, but each feature is equipped with its own weight, which finally improves the accuracy of image classification.



---

*Source: 7226598-2022-08-09.xml*