# Contemporary Advertising Text Art Design and Effect Evaluation by IoT Deep Learning under the Smart City

Authors: Likun Zhang; Xiaoyan Li; Yi Tang; Fangbin Song; Tian Xia; Wei Wang
Journal: Security and Communication Networks
 (2022)

---

## Abstract

This work intends to solve the problem that the current artistic typeface generation methods rely too much on manual intervention, lack novelty, and the single font local feature and the global feature extraction method cannot fully describe the font features. Firstly, it proposes a handwritten word recognition model based on generalized search trees (GIST) and the pyramid histogram of oriented gradient (PHOG). The local features and global features of the font are fused. Secondly, a model of automatic artistic typeface generation based on generative adversarial networks (GAN) is constructed, which can use hand-drawn fonts to automatically generate artistic typefaces in the desired style through training as needed. Finally, the generation of the huaniao typeface is used as an example. By constructing the dataset, the effectiveness of the two models is verified. The experimental results show the following: (1) The proposed handwritten character recognition model based on GIST and PHOG has a higher recognition rate of different fonts than the single GIST and PHOG features by more than 5.8%. The total recognition time is reduced by more than 49.4%, and the performance is improved significantly. (2) Compared with other popular algorithms, the constructed GAN-based automatic artistic typeface generation model has the best quality of the generation of huaniao on both the pencil sketch and the calligraphy character image dataset. Models have broad application prospects in contemporary advertising text art design. This study aims to provide important technical support for the automation of contemporary advertising text art design and the improvement of overall efficiency.


---

## Body

## 1. Introduction

“Smart city” is a term that is often mentioned in urban construction today. It is a brand-new urban form and a new direction for the city’s future development. Many cities regard wisdom as an important “label” of the city brand and an “attribute” of urban development. The beautiful vision of the smart city has become the common goal of the new form of city construction. Of course, the construction of smart cities is inseparable from the support of smart buildings. As one of the important parts of smart buildings, outdoor media is closely related to the construction of smart cities. The role of outdoor media advertising in urban development is indispensable. As one of the key contents of smart city construction, the creative orientation of outdoor media advertisements must meet the requirements of smart city construction and become a landscape for the digital display of outdoor space in smart cities. With the vigorous development of media, advertising is everywhere [1]. According to the different nature of information dissemination, advertising is divided into economic and noneconomic advertising. Economic advertisers are for-profit, such as advertising products and brands. Noneconomic advertising is not for profit but public welfare propaganda, government announcements, and cultural communication [2]. The font’s design is directly related to the overall quality of the advertisement [3]. In recent years, society’s demand for advertising has been increasing day by day. Still, the traditional way of hand-designed fonts is less efficient and focuses on the form of advertising [4]. At present, some achievements have been made in the research on the automatic generation of Chinese characters.Jiang et al. proposed a Chinese character font generation system based on deep stacking network structure orientation. The key idea of this system is to combine Chinese character domain knowledge with a deep generative network to ensure that high-quality glyphs with the correct structure are synthesized. The experimental results verify the superiority of the proposed system compared with the state-of-the-art in both visual and quantitative evaluation [5]. Feiyu et al. proposed a font effect generation model based on pyramid style features. Experiments show that this method is more suitable for the stylization of complex glyph images than other state-of-the-art methods [6]. Li et al. proposed a novel end-to-end framework for visual effect transfer of font changes between multiple text effect domains. Through extensive experimental verification and comparison, it has been proved that the model is of great significance for reducing the labor cost of font designers [7]. Liang et al. pointed out that the generation of Chinese artistic fonts with special effects can be realized by style transfer based on existing artworks. However, these methods usually use the standard fonts that come with the computer to generate the artistic typeface, and the generated artistic typeface is generally more standardized, blunt, and lacks novelty. The rules and parameters to be set for different styles of migration objects are also different, requiring more manual intervention. Moreover, in the process of artistic typeface generation, the extraction degree of font features directly affects the quality of the final product. However, most current feature extraction methods only perform local or global feature extraction alone and cannot fully describe font features [8]. The current artistic design method of the advertising text is not mature enough, which is reflected in the fact that the advertising fonts designed by computers generally lack novelty and cannot meet the needs of current social development. Therefore, by optimizing the advertising font design technology through deep learning technology, the effect of the computer advertising font design can be comprehensively improved.Firstly, a handwritten word recognition model based on generalized search trees (GIST) and the pyramid histogram of oriented gradient (PHOG) is proposed. Secondly, an automatic artistic typeface generation model based on generative adversarial network (GAN) is constructed. Finally, by constructing a dataset, the effectiveness of the two models is verified. The novelty is that the effect of the font design of advertisements is improved by optimizing the computer program. Based on the automatic programs, the traditional intuitive design method has been reformed. This study aims to provide important technical support for the automation of the contemporary advertising text art design and improve overall efficiency.


## 2. The Relationship between the Smart City and Advertising and the Model Building

### 2.1. The Relationship between Smart City Construction and Outdoor Advertising

Outdoor advertising is a medium for conveying information. The development of the city has a natural dependence on outdoor advertising. Outdoor advertising exists in urban spaces and is an important city landscape. Outdoor advertisements located in the city’s prosperous business districts and traffic intersections with high traffic flow demonstrate the city’s economic prosperity and comprehensive strength. The foundation of the construction and dissemination of smart cities is the innovation of ideas and technologies. The core is the intelligence and efficiency of urban management and services, and the essence is the improvement of citizens’ quality of life. As an important carrier connecting cities, enterprises, and people, outdoor advertising continues to innovate and develop in the intelligent era of technology and data development, adding important vitality to the evolution of smart cities.In the construction of smart cities, as an important “window” to highlight the charm of the city, outdoor smart advertising settings should be in line with consumers’ living scenes and with the city’s landscaping. Smart advertising should generate creativity based on the physical attributes of outdoor media, the natural attributes of the scene, and the consumer’s life experience, integrate the advertisement into the scene, and match the consumer’s real-life scene. Advertising should attract audience participation with innovative visuals and subtly deepen the impression of advertising information or brand information in the participation experience. The development of smart outdoor advertising is essentially the result of technical assistance and promotion. The light-emitting diode (LED) boom in the past ten years, the current fully coverage of WiFi, and the fashionable artificial intelligence augmented reality (AR), virtual reality (VR), and other technologies have broadened the creative thinking and expression of outdoor advertising. Every step of innovation in media technology aims to reconstruct a more harmonious space landscape and a more human space experience between people and the city and mobilize people’s various sense organs.Based on the background of smart city outdoor advertising, this paper introduces IoT technology and deep learning technology for research. Finally, it obtains outdoor advertising with better effects, promoting the further construction and development of smart cities.


### 2.2. Handwritten Recognition Model Based on Generalized Search Trees and Pyramid Histogram of Oriented Gradient

The handwritten recognition model proposed by using GIST can extract the global features of handwritten characters. PHOG is used to extract the local features of handwritten images, the handwritten features extracted by the two methods are fused, and the fused features are reduced in dimension by principal components analysis (PCA) [9]. The architecture of this model is shown in Figure 1.Figure 1
The architecture of the handwritten character recognition model based on GIST and PHOG.Figure 2
Flow chart of the feature fusion based on the serial fusion.In Figure1, in general, implementing a new index access method means a lot of work. The inner workings of the database must be understood, such as locking mechanisms and write-ahead logging. The GIST layer itself handles the tasks of logging and searching the tree structure.(1)
Global feature extraction of handwritten characters based on the GIST operatorGIST is an image feature descriptor, and it is used to extract the global features of an image. The GIST operator is based on the Gabor filter, and the Gabor operator can extract information from handwritten images in different directions and scales. Gabor functiongx,y is calculated by(1)gx,y=12π−x2σx2+y2σy2×cos2πf0x+φ.In (1), x and y represent the horizontal and vertical coordinates of a pixel on the image; f0 is filtering frequency; σx2 and σy2 are the Gaussian distribution variance of the Gabor function in direction x and direction y; φ is the phase difference of harmonic factors.Different Gabor filter banks can be obtained by setting different scales and direction parameters:(2)gm,nx,y=a−mgx′,y′,a>1,(3)x′=a−mxcosθ+ysinθ,y′=a−m−xsinθ+ycosθ,θ=kπn,k=1,2,…,n−1.In equation (2), m and n are the scale number and the direction number; a−m is the expansion factor of wavelet function and θ is the direction.(2)
Local feature extraction of handwritten characters based on PHOGPHOG is used to extract local contour features of images [10]. Stroke, shape, and edge are all important representative information of handwriting, and PHOG has good outline expression ability, which mainly expresses the spatial distribution of image outline information by dividing the image into grids of different scales [11]. The calculation process of PHOG is as follows:(1)
The Gamma correction method is employed to normalize handwritten images and reduce the influence of illumination on images. The Gamma compression equation is as follows:(4)Ix,y=Ix,yGamma.(2)
The horizontal and vertical gradients are needed to calculate the gradient direction histogram of handwritten images. First, the color and intensity data of the image need to be filtered to calculate the gradient. The filtering kernel is as follows:(5)−1,0,1&−1,0,1T.(3)
After the gradient of each pixel in the image in the horizontal and vertical directions is calculated, the gradient amplitude and direction of each pixel can be calculated. The calculation equation is(6)Gxx,y=Ix+1,y−Ix−1,y,(7)Gyx,y=Ix+1,y−Ix−1,y,(8)Gx,y=Gxx,y2+Gyx,y2,(9)αx,y=arctanGxx,yGyx,y.In equations (6)–(9), x and y are the rows and column labels of a pixel in the handwritten image; Gxx,y is the horizontal gradient of the image at the pixel point; Gyx,y is the gradient of the image in the vertical direction at the pixel point x,y; Gx,y is gradient amplitude at the pixel point x,y in the image; αx,y is gradient direction at the pixel point x,y.(4)
We divide the image into cells with the given size, count the direction gradient in each cell, and get the histogram of each cell, that is, the histogram corresponding to the first cell, and normalize it with(10)Hi=Hi∑j=1NHj2+ε.In (10), N is the number of bins in the histogram, and ε is a positive integer.(5)
We scan the input image horizontally and vertically, and connect all the obtained images to form the directional gradient histogram feature of the image.(3)
Feature fusion of handwritten charactersFeature vectorsA and B in the feature space are set as α and β, and the serial fusion is calculated by stringing α and β into a new feature vector γ, expressed as .(11)γ=αβ,αϵA,βϵB.If the feature ofα is m dimensions and the feature of β is n dimensions, the feature of γ is m+n dimensions. The feature fusion process based on the serial fusion is shown in Figure 2.In Figure2, the feature-level data fusion generally fuses multiple features into a comprehensive vector. There are two main methods: (1) A new feature vector is composed of multiple feature sets, and sequence fusion recognition is carried out in the high-dimensional feature vector space. (2) Multiple groups of features constitute different complex vectors, and feature recognition is fused in parallel in complex vector space. Among them, the serial fusion has the advantages of a simple and easy fusion method, which is conducive to the real-time processing of information.(4)
The dimension reduction algorithm of handwritten characters based on PCA. After the GIST feature and the PHOG feature of handwritten characters are fused by the serial fusion, the feature dimension and data redundancy increase and need to be reduced. The dimension reduction technology based on PCA can extract the most representative feature vectors from the feature set [12]. The principle of PCA is as follows:Ifa=(A1, A2, A3, …, An)T is a set of related variables affecting a certain research object, which can be transformed into a set of unrelated variables B=(B1, B2, B3, …, BN)T by PCA. This process needs to meet the following two conditions:(1)
Variance can reflect the amount of information conveyed by variables [13]. It is necessary to make the variance of variables A and B equal before and after transformation to reduce the information loss conveyed by variables as much as possible in linear transformation, as shown in(12)∑i=0nvarianceAi=∑i=0nvarianceBi.(2)
For the convertedB = (B1, B2, B3, …, BN) T, it is necessary to make B1, B2, B3, ..., BN linearly uncorrelated, B1, B2, B3, …, BN are all linear combinations of A1, A2, A3, …, An. The variance of variable B1 is the largest compared with other variables in B, which becomes the first principal component. The variance of B2 is the second principal component, and the process is repeated. In the final selection, the first variable with high variance contribution and more information is selected according to the order of principal components to show the information of the first m variables. The steps of PCA are as follows:Before PCA, it is necessary to standardize the raw data. The most commonly used standardization method is Z-score [14], and its equation is as follows:(13)Z=X−X¯S.In (13), Z is the standardized raw data, X is the corresponding index data in the original data, and X¯ is the average value of the index data in the sample population.S is the standard deviation of this index data.Z-Score can be used to make dimensionless treatment for all the data obtained, avoiding the influence of different dimensions. After the original data are processed, PCA is performed. The details are as follows:(1)
We arrange the processed data into a matrix:(14)X=x11⋯x1n⋮⋱⋮xk1⋯xkn=X1⋮Xk.In (14), xij is the new index value after the original data are standardized, n is the number of indexes contained in each data, and k is the number of total data.Xi is a vector consisting of each row of data in a matrix.(2)
The covariance of the matrix is calculated by(15)Y=y11⋯y1k⋮⋱⋮yk1⋯xkk.In equation (15), xij=Covariancexi,xj.Y is a real symmetric matrix with k eigenvalues, and the eigenvectors corresponding to different eigenvalues intersect in pairs.(3)
The eigenvalues of matrixY and its corresponding unit eigenvectors are calculated:The firstp eigenvalues are arranged from large to small, and the corresponding eigenvector is the coefficient set of the obtained principal component index Bm corresponding to the original index vector Am. If(16)ap=b1,b2,⋯,bpT.Then,(17)Yp=apBp.The contribution rategj of a new comprehensive index Bi to population variance is as follows:(18)gj=varianceBj∑i=1mvarianceBi.The high contribution rate means that the principal component contains more information.(4)
We determine the number of principal component indexes.Usually, the evaluation of the cumulative variance contribution rateGj is used to judge the number of principal component indexes, and its calculation equation is(19)Gj=∑i=1jλi∑k=1mλk.Generally, there are two ways for the selection. First, when the value ofGj is greater than 80%, the value of j is the number of the selected principal component indexes; Second, the unit feature vectors with λ>1 corresponding to the selected feature roots form a transformation matrix for principal component selection, and the number of principal components is the number of feature roots that meet the conditions. The main steps of PCA are shown in Figure 3.Figure 3
Main steps of PCA.In Figure3, PCA-based research has many advantages. Firstly, it can eliminate the correlation between evaluation indicators. Principal component analysis forms independent principal components after transforming the original indicator variables. The practice has proved that the higher the correlation between the indicators, the better the effect of principal component analysis. Secondly, the workload of indicator selection can be reduced. It is difficult for other evaluation methods to eliminate the correlation between evaluation indicators, so it takes a lot of effort to select indicators. Principal component analysis is relatively easy to select indicators because it can eliminate this correlation effect. When there are many rating indicators, a few comprehensive indicators are used to replace the original indicators for analysis, while retaining most information. The principal components are arranged in order according to the size of the variance. When analyzing the problem, some principal components are discarded, and only a few principal components with larger variance before and after are used to represent the original variables, which reduces the computational workload. Then, in the comprehensive evaluation function, the weight of each principal component is the contribution rate. It reflects the proportion of the amount of information that the principal component contains in the original data to the total amount of information. This approach is used to determine whether the weights are objective and reasonable. It overcomes the shortcomings of determining weights in some evaluation methods. Finally, the calculation of this method is relatively standardized, is easy to implement on the computer, and can also use special software.


### 2.3. Automatic Generation Model of an Artistic Typeface Based on Generative Adversarial Networks

The features of the corresponding handwritten image set can be obtained by using the feature extraction method of the handwritten image proposed above. On this basis, a GAN-based artistic word generation model is implemented. It can complete the conversion from the source domain (original handwritten sketch) to the target domain (artistic typeface image) through a series of training, and the required artistic fonts are generated. The architecture of the GAN model is shown in Figure4.Figure 4
The architecture of the GAN-based artistic word generation model.In Figure4, GAN is a generative model. Firstly, compared with other generative models, GAN only uses backpropagation without complex Markov chains. Secondly, compared to other models, GAN can generate clearer and more realistic samples. Finally, GAN uses an unsupervised learning method. This method can be widely used in unsupervised and semi-supervised learning.


#### 2.3.1. GAN

GAN is a generative model, and it has powerful image generation and conversion functions. It contains two deep learning models, which are called generator and discriminator [15]. The generator is mainly responsible for generating false samples Gz and inputting them into the discriminator, and the discriminator cannot determine that the generated samples are false [16]. The discriminator distinguishes the true and false of the input samples and judges all the false samples generated by the generator as false [17]. The generator (G) outputs the false samples, and the discriminator (D) outputs the sample discrimination rate, which is converted into the objective optimization function VD,G and fed back to the generator and discriminator, making the generated samples more authentic. The principle of GAN is shown in Figure 5.Figure 5
Schematic diagram of GAN.In Figure5, in contrast to other generative models, GAN no longer requires an assumed data distribution. This model does not need to p(x), but uses distribution to directly sample sampling, which can theoretically fully approximate the real data. It is one of the advantages of GAN.Objective functionVD,G is calculated by(20)VD,G=Ex∼pxlogDx+Ez∼pzlog1−DGz.In (20), x is the original sample, px is the distribution of x, z is the noise data, and pz is the prior probability distribution of input noise variables. VD,G is minimized by the generator, and the discriminator maximizes it. This process can be expressed as(21)minGmaxDVD,G=Ex∼pxlogDx+log1−DGz.DiscriminatorD is regarded as a variable, and mn represent the real picture sample and the generated sample, respectively. The equations are as follows:(22)fD=mlogD+nlog1−D,(23)dfDdD=m×1D+n×11−D×−1.If the value of (23) is 0, then(24)m×1D∗=n×11−D∗.In (24), D∗ represents the optimal discriminator. The equation is simplified as(25)m×1−D∗=n×D∗.Optimal valueDG∗x of the discriminator is calculated by(26)DG∗x=pxpx+pgx.In (26), pgx is the original sample distribution learned by the generator, and maximizing and the minimizing process VD∗,G can be described as(27)CG=maxDVD,G=VD∗,G=maxEx∼pxlogpxpx+pgx+Ex∼pgxlogpxpx+pgx=∫xpxlogDG∗xdx+∫xpzlog1−DGzdz=∫xpxlogDG∗x+pgxlog1−Dxdx.When px=pgx, the minimum value of CG and optimal solution VD,G are obtained.


#### 2.3.2. Optimization of GAN

The loss function in the optimization model mainly consists of antagonism loss and structural similarity (SS) [18]. Among them, the former distributes image data generated by the model closer to the target domain image. If the sketch input to the model is X and the artistic typeface image to be generated is Y, the model is described as: when xii=1N and yii=1N, the model needs to learn the mapping from X to Y. For generator G and discriminator D, the loss function of GAN is(28)ℒGANG,D=Ex,y∼px,ylogDx,y+Ex∼pxlog1−Dx,Gx.In (28), ℒGANG,D is the antagonism loss function. The generator generates realistic false images to “cheat” the discriminator, and the discriminator determines whether the accepted image is a true artistic typeface image or a false image generated by the generator.SS is used to measure the similarity between two images. The artistic typeface image can be used as the reference image, and the generated image is the image to be evaluated. SS can calculate the distance between the two images. The calculation method is as follows:Ifx and y represent the image block in the generated image and the real artistic typeface image, respectively, the brightness comparison function is gained by(29)lx,y=2μxμy+C1μx2+μy2+C1.The image comparison function is calculated by(30)cx,y=2σxσy+C2σx2+σy2+C2.The image structure similarity function is obtained by(31)sx,y=σxy+0.5C2σxσy+0.5C2.In equations (29)–(31),V μx is the mean of x, μy is the mean of y, σx is the standard deviation x, σxy is the standard deviation of x and y, and the default values of C1 and C2 are 0.02 and 0.03, respectively. After simplification, for the pixels of the image to be compared, the value of SS between x and y can be calculated by(32)SSp=2μxμy+C1μx2+μy2+C1⋅2σxy+C2σx2+σy2+C2.The value range of SS is [0, 1]. The greater the value, the higher the image similarity and the better the image quality generated by the model. When the model is optimized with the minimum loss, the opposite number of SS is taken to avoid negative loss, and the SS loss function is defined by(33)ℒSSG=1−1N∑p=1N2μxμy+C1μx2+μy2+C1⋅2σxy+C2σx2+σy2+C2.In (33), N represents the number of windows, and the loss function is obtained by(34)LG,D=ℒGANG,D+αℒSSG.In (34), ℒGANG,D is anti-loss function, ℒSSG is the loss of structural similarity, and α is a hyperparameter.


### 2.4. Experimental Methods

#### 2.4.1. The Validity Test of the Handwritten Character Recognition Model Based on GIST and PHOG

(1) Selection of Datasets. The effectiveness of the recognition model proposed will be verified by using printed word images and calligraphy word images which are difficult to recognize. System standard fonts and Chinese character book sub-library from China-America Digital Academic Library (CADAL) [19] are selected, respectively. CADAL collects nearly 3.5 million books, including books, calligraphy works, and dissertations. Five fonts, regular script, running script, seal script, official script, and cursive script, are selected from the two fonts, respectively, and the number of pictures in each font is 3,000. 80% are used as training sets, and the remaining 20% as test sets.(2) Specific Experimental Methods. The recognition model runs on the hardware platform of 3.40 GHz CPU and 8G memory, and is implemented on Matlab B2016a simulation software. The main method is to extract the features of characters in images by using the method based on the fusion features of GIST and PHOG, to fuse the two features by the serial fusion, then to reduce the dimension of features by PCA, and finally to output the recognition results. The recognition results of this model are compared with the features of single GIST and PHOG.


#### 2.4.2. The Validity Verification of the Automatic Generation Model of an Artistic Typeface Based on GAN

(1) Selection of Datasets. Pencil sketches and calligraphy images are used as models and input objects to verify the validity of the model by generating the “huaniao typeface,” known as the treasure of traditional Chinese art (The word huaniao typeface got its name because of its multi-stroke flower and the bird pattern. This writing form takes characters as the carrier and replaces the strokes of characters with patterns of flowers, birds, grass, fish, insects, mountains, water, and spirals. This font type is drawn in multicolor and formed according to the basic glyphs, which integrates painting and calligraphy. This typeface gives a richer picture than a single ink drawing.). When training the model, the training set will consist of two parts: the source domain (pencil sketch image and calligraphy character image) and the target domain (the huaniao typeface image) image dataset. The resolution of all images is uniformly adjusted to 256∗256.This study searched and downloaded a total of 1200 images of the huaniao typeface corresponding to 372 common Chinese characters on the Internet. The first 1000 images are used as the training set, and the last 200 images are used as the test set to validate the model. The pencil sketch image dataset is mainly obtained by processing the huaniao mentionedabove typeface dataset through the pencil image generation algorithm based on the convolutional neural network (CNN) proposed by Cai and Song to generate the corresponding pencil sketch image. The CNN algorithm can not only generate pencil sketches from natural images but also preserve the tones of natural images, and the painting style is flexible. Pen sketch images are correspondingly distorted and deformed to make their forms richer and more diverse [20]. The calligraphy character image data set is a black and white processing and a certain distortion and deformation to simulate the input image. In the process of using neural network technology, the computing power of neural network technology is improved through repeated training, and the comprehensive effect of the model is improved.(2) Specific Experimental Methods. The computer processor used in the experiment is Intel (R) Core (TM) i7-7700k CPU @ 4.20ghz, the graphics processor is GeForce GTX 1080 Ti, and the memory size is 11 GB. One thousand pencil sketches, calligraphy images, and their corresponding flower-and-bird images are selected from the training set established above to train the GAN model. The model is tested with the test set after training. Finally, the model’s validity is measured by calculating the similarity between the generated image and the original image. Other existing algorithms, such as convolutional neural networks (CNN) [21], cycle-consistent predictive networks (CycleCAN) [22], pixel-to-pixel (Pix2Pix) [23] and pixel-to-pixel high definition (Pix2pixHD) [24], are selected for comparative analysis.


#### 2.4.3. Evaluation Indicators

SS, PSNR (peak signal to noise ratio), FSIM (feature similarity), and GMSD (gradient magnitude similarity deviation) are selected as the evaluation indexes of the model. The definition and calculation of each index are as follows:(1) PSNR. Because the image is compressed in the process of output, there will be some differences between it and the original image. PSNR is used to measure the quality of the processed image. The larger the value, the less the image distortion. The equation of PSNR is as follows:(35)PSNR=10×log102n−12MSE.In (35), n is the number of bits of each sampling value, and MSE is mean square error, which is a measure reflecting the degree of difference between the estimated quantity and the estimated quantity. MSE is calculated by(36)MSE=1n∑i=1ny⌢i−yi2.In (36), y^i is the estimated value, yi is the actual value, and n is the total amount of data.(2) FSIM. FSIM evaluates the image quality by using the phase consistency (PC) feature and the gradient magnitude (GM) feature. The higher the value, the better the image quality. The calculation of PC is shown in(37)PCx=∑jEθjxε+∑n∑jAn,θjx.In (37), x represents a pixel, θj is the direction angle of the filter, Eθj is the energy for direction θj, ε is a smaller constant, and An,θjθj is the amplitude of the direction. Gradient information GM of the image is counted by(38)GM=Gx2+Gy2.In (38), Gx,Gy are the gradient values in the horizontal and vertical directions, respectively. FSIM is coupled by PC and GM. For two images F1 and F2, the similarity is calculated by(39)SPCx=2PC1x⋅PC2x+T1PC12x+PC22x+T1.In (39), PC1,PC2 are the phase consistency of the two pictures, and T1 is a constant. The similarity of GM is calculated by(40)SGMx=2GM1x⋅GM2x+T2GM12x+GMx+T2.In (40), GM1,GM2 are the gradient information values of the two graphs and T2 is a constant. The similarity of the fusion is defined by(41)SLx=SPCxα⋅SGMxβ.In (41), α,β are set to 1 and FSIM of the image is calculated by(42)FSIM=∑x∈ΩSLx⋅PCmx∑x∈ΩPCmx.In (42), Ω is the whole airspace of the image and PCm is calculated by(43)PCm=maxPC1x,PC2x.(3) GMSD. GMSD measures the image quality by calculating the standard deviation of local image quality. The higher the value, the worse the image quality. Gradient amplitude can reflect structural information and set it as a feature, and the prediction score of picture quality can be obtained more accurately. The Prewitt operator is used to obtain gradient information and convolved with the reference image r and the distorted image d to obtain the gradients of two images in the horizontal and vertical directions. mr and md of the gradient amplitude of the image at position i are counted by(44)mri=r⊗hx2i+r⊗hy2i.(45)mdi=d⊗hx2i+d⊗hy2i.In (44) and (45), ⊗ is convolution operation, and hx,hy are Prewitt operators along with directions x and y. The gradient magnitude similarity (GMS) of the image is calculated by(46)GMSi=2mrimdi+cmr2i+md2i+c.In (46), c is a constant. The equation for calculating the gradient magnitude similarity mean (GMSM) is(47)GMSM=1N∑i=1NGMSi.In (47), N is the total number of pixels in the image. Gradient amplitude similarity deviation GMSD is calculated by(48)GMSD=1N∑i=1NGMSi−GMSM2.


## 2.1. The Relationship between Smart City Construction and Outdoor Advertising

Outdoor advertising is a medium for conveying information. The development of the city has a natural dependence on outdoor advertising. Outdoor advertising exists in urban spaces and is an important city landscape. Outdoor advertisements located in the city’s prosperous business districts and traffic intersections with high traffic flow demonstrate the city’s economic prosperity and comprehensive strength. The foundation of the construction and dissemination of smart cities is the innovation of ideas and technologies. The core is the intelligence and efficiency of urban management and services, and the essence is the improvement of citizens’ quality of life. As an important carrier connecting cities, enterprises, and people, outdoor advertising continues to innovate and develop in the intelligent era of technology and data development, adding important vitality to the evolution of smart cities.In the construction of smart cities, as an important “window” to highlight the charm of the city, outdoor smart advertising settings should be in line with consumers’ living scenes and with the city’s landscaping. Smart advertising should generate creativity based on the physical attributes of outdoor media, the natural attributes of the scene, and the consumer’s life experience, integrate the advertisement into the scene, and match the consumer’s real-life scene. Advertising should attract audience participation with innovative visuals and subtly deepen the impression of advertising information or brand information in the participation experience. The development of smart outdoor advertising is essentially the result of technical assistance and promotion. The light-emitting diode (LED) boom in the past ten years, the current fully coverage of WiFi, and the fashionable artificial intelligence augmented reality (AR), virtual reality (VR), and other technologies have broadened the creative thinking and expression of outdoor advertising. Every step of innovation in media technology aims to reconstruct a more harmonious space landscape and a more human space experience between people and the city and mobilize people’s various sense organs.Based on the background of smart city outdoor advertising, this paper introduces IoT technology and deep learning technology for research. Finally, it obtains outdoor advertising with better effects, promoting the further construction and development of smart cities.


## 2.2. Handwritten Recognition Model Based on Generalized Search Trees and Pyramid Histogram of Oriented Gradient

The handwritten recognition model proposed by using GIST can extract the global features of handwritten characters. PHOG is used to extract the local features of handwritten images, the handwritten features extracted by the two methods are fused, and the fused features are reduced in dimension by principal components analysis (PCA) [9]. The architecture of this model is shown in Figure 1.Figure 1
The architecture of the handwritten character recognition model based on GIST and PHOG.Figure 2
Flow chart of the feature fusion based on the serial fusion.In Figure1, in general, implementing a new index access method means a lot of work. The inner workings of the database must be understood, such as locking mechanisms and write-ahead logging. The GIST layer itself handles the tasks of logging and searching the tree structure.(1)
Global feature extraction of handwritten characters based on the GIST operatorGIST is an image feature descriptor, and it is used to extract the global features of an image. The GIST operator is based on the Gabor filter, and the Gabor operator can extract information from handwritten images in different directions and scales. Gabor functiongx,y is calculated by(1)gx,y=12π−x2σx2+y2σy2×cos2πf0x+φ.In (1), x and y represent the horizontal and vertical coordinates of a pixel on the image; f0 is filtering frequency; σx2 and σy2 are the Gaussian distribution variance of the Gabor function in direction x and direction y; φ is the phase difference of harmonic factors.Different Gabor filter banks can be obtained by setting different scales and direction parameters:(2)gm,nx,y=a−mgx′,y′,a>1,(3)x′=a−mxcosθ+ysinθ,y′=a−m−xsinθ+ycosθ,θ=kπn,k=1,2,…,n−1.In equation (2), m and n are the scale number and the direction number; a−m is the expansion factor of wavelet function and θ is the direction.(2)
Local feature extraction of handwritten characters based on PHOGPHOG is used to extract local contour features of images [10]. Stroke, shape, and edge are all important representative information of handwriting, and PHOG has good outline expression ability, which mainly expresses the spatial distribution of image outline information by dividing the image into grids of different scales [11]. The calculation process of PHOG is as follows:(1)
The Gamma correction method is employed to normalize handwritten images and reduce the influence of illumination on images. The Gamma compression equation is as follows:(4)Ix,y=Ix,yGamma.(2)
The horizontal and vertical gradients are needed to calculate the gradient direction histogram of handwritten images. First, the color and intensity data of the image need to be filtered to calculate the gradient. The filtering kernel is as follows:(5)−1,0,1&−1,0,1T.(3)
After the gradient of each pixel in the image in the horizontal and vertical directions is calculated, the gradient amplitude and direction of each pixel can be calculated. The calculation equation is(6)Gxx,y=Ix+1,y−Ix−1,y,(7)Gyx,y=Ix+1,y−Ix−1,y,(8)Gx,y=Gxx,y2+Gyx,y2,(9)αx,y=arctanGxx,yGyx,y.In equations (6)–(9), x and y are the rows and column labels of a pixel in the handwritten image; Gxx,y is the horizontal gradient of the image at the pixel point; Gyx,y is the gradient of the image in the vertical direction at the pixel point x,y; Gx,y is gradient amplitude at the pixel point x,y in the image; αx,y is gradient direction at the pixel point x,y.(4)
We divide the image into cells with the given size, count the direction gradient in each cell, and get the histogram of each cell, that is, the histogram corresponding to the first cell, and normalize it with(10)Hi=Hi∑j=1NHj2+ε.In (10), N is the number of bins in the histogram, and ε is a positive integer.(5)
We scan the input image horizontally and vertically, and connect all the obtained images to form the directional gradient histogram feature of the image.(3)
Feature fusion of handwritten charactersFeature vectorsA and B in the feature space are set as α and β, and the serial fusion is calculated by stringing α and β into a new feature vector γ, expressed as .(11)γ=αβ,αϵA,βϵB.If the feature ofα is m dimensions and the feature of β is n dimensions, the feature of γ is m+n dimensions. The feature fusion process based on the serial fusion is shown in Figure 2.In Figure2, the feature-level data fusion generally fuses multiple features into a comprehensive vector. There are two main methods: (1) A new feature vector is composed of multiple feature sets, and sequence fusion recognition is carried out in the high-dimensional feature vector space. (2) Multiple groups of features constitute different complex vectors, and feature recognition is fused in parallel in complex vector space. Among them, the serial fusion has the advantages of a simple and easy fusion method, which is conducive to the real-time processing of information.(4)
The dimension reduction algorithm of handwritten characters based on PCA. After the GIST feature and the PHOG feature of handwritten characters are fused by the serial fusion, the feature dimension and data redundancy increase and need to be reduced. The dimension reduction technology based on PCA can extract the most representative feature vectors from the feature set [12]. The principle of PCA is as follows:Ifa=(A1, A2, A3, …, An)T is a set of related variables affecting a certain research object, which can be transformed into a set of unrelated variables B=(B1, B2, B3, …, BN)T by PCA. This process needs to meet the following two conditions:(1)
Variance can reflect the amount of information conveyed by variables [13]. It is necessary to make the variance of variables A and B equal before and after transformation to reduce the information loss conveyed by variables as much as possible in linear transformation, as shown in(12)∑i=0nvarianceAi=∑i=0nvarianceBi.(2)
For the convertedB = (B1, B2, B3, …, BN) T, it is necessary to make B1, B2, B3, ..., BN linearly uncorrelated, B1, B2, B3, …, BN are all linear combinations of A1, A2, A3, …, An. The variance of variable B1 is the largest compared with other variables in B, which becomes the first principal component. The variance of B2 is the second principal component, and the process is repeated. In the final selection, the first variable with high variance contribution and more information is selected according to the order of principal components to show the information of the first m variables. The steps of PCA are as follows:Before PCA, it is necessary to standardize the raw data. The most commonly used standardization method is Z-score [14], and its equation is as follows:(13)Z=X−X¯S.In (13), Z is the standardized raw data, X is the corresponding index data in the original data, and X¯ is the average value of the index data in the sample population.S is the standard deviation of this index data.Z-Score can be used to make dimensionless treatment for all the data obtained, avoiding the influence of different dimensions. After the original data are processed, PCA is performed. The details are as follows:(1)
We arrange the processed data into a matrix:(14)X=x11⋯x1n⋮⋱⋮xk1⋯xkn=X1⋮Xk.In (14), xij is the new index value after the original data are standardized, n is the number of indexes contained in each data, and k is the number of total data.Xi is a vector consisting of each row of data in a matrix.(2)
The covariance of the matrix is calculated by(15)Y=y11⋯y1k⋮⋱⋮yk1⋯xkk.In equation (15), xij=Covariancexi,xj.Y is a real symmetric matrix with k eigenvalues, and the eigenvectors corresponding to different eigenvalues intersect in pairs.(3)
The eigenvalues of matrixY and its corresponding unit eigenvectors are calculated:The firstp eigenvalues are arranged from large to small, and the corresponding eigenvector is the coefficient set of the obtained principal component index Bm corresponding to the original index vector Am. If(16)ap=b1,b2,⋯,bpT.Then,(17)Yp=apBp.The contribution rategj of a new comprehensive index Bi to population variance is as follows:(18)gj=varianceBj∑i=1mvarianceBi.The high contribution rate means that the principal component contains more information.(4)
We determine the number of principal component indexes.Usually, the evaluation of the cumulative variance contribution rateGj is used to judge the number of principal component indexes, and its calculation equation is(19)Gj=∑i=1jλi∑k=1mλk.Generally, there are two ways for the selection. First, when the value ofGj is greater than 80%, the value of j is the number of the selected principal component indexes; Second, the unit feature vectors with λ>1 corresponding to the selected feature roots form a transformation matrix for principal component selection, and the number of principal components is the number of feature roots that meet the conditions. The main steps of PCA are shown in Figure 3.Figure 3
Main steps of PCA.In Figure3, PCA-based research has many advantages. Firstly, it can eliminate the correlation between evaluation indicators. Principal component analysis forms independent principal components after transforming the original indicator variables. The practice has proved that the higher the correlation between the indicators, the better the effect of principal component analysis. Secondly, the workload of indicator selection can be reduced. It is difficult for other evaluation methods to eliminate the correlation between evaluation indicators, so it takes a lot of effort to select indicators. Principal component analysis is relatively easy to select indicators because it can eliminate this correlation effect. When there are many rating indicators, a few comprehensive indicators are used to replace the original indicators for analysis, while retaining most information. The principal components are arranged in order according to the size of the variance. When analyzing the problem, some principal components are discarded, and only a few principal components with larger variance before and after are used to represent the original variables, which reduces the computational workload. Then, in the comprehensive evaluation function, the weight of each principal component is the contribution rate. It reflects the proportion of the amount of information that the principal component contains in the original data to the total amount of information. This approach is used to determine whether the weights are objective and reasonable. It overcomes the shortcomings of determining weights in some evaluation methods. Finally, the calculation of this method is relatively standardized, is easy to implement on the computer, and can also use special software.


## 2.3. Automatic Generation Model of an Artistic Typeface Based on Generative Adversarial Networks

The features of the corresponding handwritten image set can be obtained by using the feature extraction method of the handwritten image proposed above. On this basis, a GAN-based artistic word generation model is implemented. It can complete the conversion from the source domain (original handwritten sketch) to the target domain (artistic typeface image) through a series of training, and the required artistic fonts are generated. The architecture of the GAN model is shown in Figure4.Figure 4
The architecture of the GAN-based artistic word generation model.In Figure4, GAN is a generative model. Firstly, compared with other generative models, GAN only uses backpropagation without complex Markov chains. Secondly, compared to other models, GAN can generate clearer and more realistic samples. Finally, GAN uses an unsupervised learning method. This method can be widely used in unsupervised and semi-supervised learning.


### 2.3.1. GAN

GAN is a generative model, and it has powerful image generation and conversion functions. It contains two deep learning models, which are called generator and discriminator [15]. The generator is mainly responsible for generating false samples Gz and inputting them into the discriminator, and the discriminator cannot determine that the generated samples are false [16]. The discriminator distinguishes the true and false of the input samples and judges all the false samples generated by the generator as false [17]. The generator (G) outputs the false samples, and the discriminator (D) outputs the sample discrimination rate, which is converted into the objective optimization function VD,G and fed back to the generator and discriminator, making the generated samples more authentic. The principle of GAN is shown in Figure 5.Figure 5
Schematic diagram of GAN.In Figure5, in contrast to other generative models, GAN no longer requires an assumed data distribution. This model does not need to p(x), but uses distribution to directly sample sampling, which can theoretically fully approximate the real data. It is one of the advantages of GAN.Objective functionVD,G is calculated by(20)VD,G=Ex∼pxlogDx+Ez∼pzlog1−DGz.In (20), x is the original sample, px is the distribution of x, z is the noise data, and pz is the prior probability distribution of input noise variables. VD,G is minimized by the generator, and the discriminator maximizes it. This process can be expressed as(21)minGmaxDVD,G=Ex∼pxlogDx+log1−DGz.DiscriminatorD is regarded as a variable, and mn represent the real picture sample and the generated sample, respectively. The equations are as follows:(22)fD=mlogD+nlog1−D,(23)dfDdD=m×1D+n×11−D×−1.If the value of (23) is 0, then(24)m×1D∗=n×11−D∗.In (24), D∗ represents the optimal discriminator. The equation is simplified as(25)m×1−D∗=n×D∗.Optimal valueDG∗x of the discriminator is calculated by(26)DG∗x=pxpx+pgx.In (26), pgx is the original sample distribution learned by the generator, and maximizing and the minimizing process VD∗,G can be described as(27)CG=maxDVD,G=VD∗,G=maxEx∼pxlogpxpx+pgx+Ex∼pgxlogpxpx+pgx=∫xpxlogDG∗xdx+∫xpzlog1−DGzdz=∫xpxlogDG∗x+pgxlog1−Dxdx.When px=pgx, the minimum value of CG and optimal solution VD,G are obtained.


### 2.3.2. Optimization of GAN

The loss function in the optimization model mainly consists of antagonism loss and structural similarity (SS) [18]. Among them, the former distributes image data generated by the model closer to the target domain image. If the sketch input to the model is X and the artistic typeface image to be generated is Y, the model is described as: when xii=1N and yii=1N, the model needs to learn the mapping from X to Y. For generator G and discriminator D, the loss function of GAN is(28)ℒGANG,D=Ex,y∼px,ylogDx,y+Ex∼pxlog1−Dx,Gx.In (28), ℒGANG,D is the antagonism loss function. The generator generates realistic false images to “cheat” the discriminator, and the discriminator determines whether the accepted image is a true artistic typeface image or a false image generated by the generator.SS is used to measure the similarity between two images. The artistic typeface image can be used as the reference image, and the generated image is the image to be evaluated. SS can calculate the distance between the two images. The calculation method is as follows:Ifx and y represent the image block in the generated image and the real artistic typeface image, respectively, the brightness comparison function is gained by(29)lx,y=2μxμy+C1μx2+μy2+C1.The image comparison function is calculated by(30)cx,y=2σxσy+C2σx2+σy2+C2.The image structure similarity function is obtained by(31)sx,y=σxy+0.5C2σxσy+0.5C2.In equations (29)–(31),V μx is the mean of x, μy is the mean of y, σx is the standard deviation x, σxy is the standard deviation of x and y, and the default values of C1 and C2 are 0.02 and 0.03, respectively. After simplification, for the pixels of the image to be compared, the value of SS between x and y can be calculated by(32)SSp=2μxμy+C1μx2+μy2+C1⋅2σxy+C2σx2+σy2+C2.The value range of SS is [0, 1]. The greater the value, the higher the image similarity and the better the image quality generated by the model. When the model is optimized with the minimum loss, the opposite number of SS is taken to avoid negative loss, and the SS loss function is defined by(33)ℒSSG=1−1N∑p=1N2μxμy+C1μx2+μy2+C1⋅2σxy+C2σx2+σy2+C2.In (33), N represents the number of windows, and the loss function is obtained by(34)LG,D=ℒGANG,D+αℒSSG.In (34), ℒGANG,D is anti-loss function, ℒSSG is the loss of structural similarity, and α is a hyperparameter.


## 2.3.1. GAN

GAN is a generative model, and it has powerful image generation and conversion functions. It contains two deep learning models, which are called generator and discriminator [15]. The generator is mainly responsible for generating false samples Gz and inputting them into the discriminator, and the discriminator cannot determine that the generated samples are false [16]. The discriminator distinguishes the true and false of the input samples and judges all the false samples generated by the generator as false [17]. The generator (G) outputs the false samples, and the discriminator (D) outputs the sample discrimination rate, which is converted into the objective optimization function VD,G and fed back to the generator and discriminator, making the generated samples more authentic. The principle of GAN is shown in Figure 5.Figure 5
Schematic diagram of GAN.In Figure5, in contrast to other generative models, GAN no longer requires an assumed data distribution. This model does not need to p(x), but uses distribution to directly sample sampling, which can theoretically fully approximate the real data. It is one of the advantages of GAN.Objective functionVD,G is calculated by(20)VD,G=Ex∼pxlogDx+Ez∼pzlog1−DGz.In (20), x is the original sample, px is the distribution of x, z is the noise data, and pz is the prior probability distribution of input noise variables. VD,G is minimized by the generator, and the discriminator maximizes it. This process can be expressed as(21)minGmaxDVD,G=Ex∼pxlogDx+log1−DGz.DiscriminatorD is regarded as a variable, and mn represent the real picture sample and the generated sample, respectively. The equations are as follows:(22)fD=mlogD+nlog1−D,(23)dfDdD=m×1D+n×11−D×−1.If the value of (23) is 0, then(24)m×1D∗=n×11−D∗.In (24), D∗ represents the optimal discriminator. The equation is simplified as(25)m×1−D∗=n×D∗.Optimal valueDG∗x of the discriminator is calculated by(26)DG∗x=pxpx+pgx.In (26), pgx is the original sample distribution learned by the generator, and maximizing and the minimizing process VD∗,G can be described as(27)CG=maxDVD,G=VD∗,G=maxEx∼pxlogpxpx+pgx+Ex∼pgxlogpxpx+pgx=∫xpxlogDG∗xdx+∫xpzlog1−DGzdz=∫xpxlogDG∗x+pgxlog1−Dxdx.When px=pgx, the minimum value of CG and optimal solution VD,G are obtained.


## 2.3.2. Optimization of GAN

The loss function in the optimization model mainly consists of antagonism loss and structural similarity (SS) [18]. Among them, the former distributes image data generated by the model closer to the target domain image. If the sketch input to the model is X and the artistic typeface image to be generated is Y, the model is described as: when xii=1N and yii=1N, the model needs to learn the mapping from X to Y. For generator G and discriminator D, the loss function of GAN is(28)ℒGANG,D=Ex,y∼px,ylogDx,y+Ex∼pxlog1−Dx,Gx.In (28), ℒGANG,D is the antagonism loss function. The generator generates realistic false images to “cheat” the discriminator, and the discriminator determines whether the accepted image is a true artistic typeface image or a false image generated by the generator.SS is used to measure the similarity between two images. The artistic typeface image can be used as the reference image, and the generated image is the image to be evaluated. SS can calculate the distance between the two images. The calculation method is as follows:Ifx and y represent the image block in the generated image and the real artistic typeface image, respectively, the brightness comparison function is gained by(29)lx,y=2μxμy+C1μx2+μy2+C1.The image comparison function is calculated by(30)cx,y=2σxσy+C2σx2+σy2+C2.The image structure similarity function is obtained by(31)sx,y=σxy+0.5C2σxσy+0.5C2.In equations (29)–(31),V μx is the mean of x, μy is the mean of y, σx is the standard deviation x, σxy is the standard deviation of x and y, and the default values of C1 and C2 are 0.02 and 0.03, respectively. After simplification, for the pixels of the image to be compared, the value of SS between x and y can be calculated by(32)SSp=2μxμy+C1μx2+μy2+C1⋅2σxy+C2σx2+σy2+C2.The value range of SS is [0, 1]. The greater the value, the higher the image similarity and the better the image quality generated by the model. When the model is optimized with the minimum loss, the opposite number of SS is taken to avoid negative loss, and the SS loss function is defined by(33)ℒSSG=1−1N∑p=1N2μxμy+C1μx2+μy2+C1⋅2σxy+C2σx2+σy2+C2.In (33), N represents the number of windows, and the loss function is obtained by(34)LG,D=ℒGANG,D+αℒSSG.In (34), ℒGANG,D is anti-loss function, ℒSSG is the loss of structural similarity, and α is a hyperparameter.


## 2.4. Experimental Methods

### 2.4.1. The Validity Test of the Handwritten Character Recognition Model Based on GIST and PHOG

(1) Selection of Datasets. The effectiveness of the recognition model proposed will be verified by using printed word images and calligraphy word images which are difficult to recognize. System standard fonts and Chinese character book sub-library from China-America Digital Academic Library (CADAL) [19] are selected, respectively. CADAL collects nearly 3.5 million books, including books, calligraphy works, and dissertations. Five fonts, regular script, running script, seal script, official script, and cursive script, are selected from the two fonts, respectively, and the number of pictures in each font is 3,000. 80% are used as training sets, and the remaining 20% as test sets.(2) Specific Experimental Methods. The recognition model runs on the hardware platform of 3.40 GHz CPU and 8G memory, and is implemented on Matlab B2016a simulation software. The main method is to extract the features of characters in images by using the method based on the fusion features of GIST and PHOG, to fuse the two features by the serial fusion, then to reduce the dimension of features by PCA, and finally to output the recognition results. The recognition results of this model are compared with the features of single GIST and PHOG.


### 2.4.2. The Validity Verification of the Automatic Generation Model of an Artistic Typeface Based on GAN

(1) Selection of Datasets. Pencil sketches and calligraphy images are used as models and input objects to verify the validity of the model by generating the “huaniao typeface,” known as the treasure of traditional Chinese art (The word huaniao typeface got its name because of its multi-stroke flower and the bird pattern. This writing form takes characters as the carrier and replaces the strokes of characters with patterns of flowers, birds, grass, fish, insects, mountains, water, and spirals. This font type is drawn in multicolor and formed according to the basic glyphs, which integrates painting and calligraphy. This typeface gives a richer picture than a single ink drawing.). When training the model, the training set will consist of two parts: the source domain (pencil sketch image and calligraphy character image) and the target domain (the huaniao typeface image) image dataset. The resolution of all images is uniformly adjusted to 256∗256.This study searched and downloaded a total of 1200 images of the huaniao typeface corresponding to 372 common Chinese characters on the Internet. The first 1000 images are used as the training set, and the last 200 images are used as the test set to validate the model. The pencil sketch image dataset is mainly obtained by processing the huaniao mentionedabove typeface dataset through the pencil image generation algorithm based on the convolutional neural network (CNN) proposed by Cai and Song to generate the corresponding pencil sketch image. The CNN algorithm can not only generate pencil sketches from natural images but also preserve the tones of natural images, and the painting style is flexible. Pen sketch images are correspondingly distorted and deformed to make their forms richer and more diverse [20]. The calligraphy character image data set is a black and white processing and a certain distortion and deformation to simulate the input image. In the process of using neural network technology, the computing power of neural network technology is improved through repeated training, and the comprehensive effect of the model is improved.(2) Specific Experimental Methods. The computer processor used in the experiment is Intel (R) Core (TM) i7-7700k CPU @ 4.20ghz, the graphics processor is GeForce GTX 1080 Ti, and the memory size is 11 GB. One thousand pencil sketches, calligraphy images, and their corresponding flower-and-bird images are selected from the training set established above to train the GAN model. The model is tested with the test set after training. Finally, the model’s validity is measured by calculating the similarity between the generated image and the original image. Other existing algorithms, such as convolutional neural networks (CNN) [21], cycle-consistent predictive networks (CycleCAN) [22], pixel-to-pixel (Pix2Pix) [23] and pixel-to-pixel high definition (Pix2pixHD) [24], are selected for comparative analysis.


### 2.4.3. Evaluation Indicators

SS, PSNR (peak signal to noise ratio), FSIM (feature similarity), and GMSD (gradient magnitude similarity deviation) are selected as the evaluation indexes of the model. The definition and calculation of each index are as follows:(1) PSNR. Because the image is compressed in the process of output, there will be some differences between it and the original image. PSNR is used to measure the quality of the processed image. The larger the value, the less the image distortion. The equation of PSNR is as follows:(35)PSNR=10×log102n−12MSE.In (35), n is the number of bits of each sampling value, and MSE is mean square error, which is a measure reflecting the degree of difference between the estimated quantity and the estimated quantity. MSE is calculated by(36)MSE=1n∑i=1ny⌢i−yi2.In (36), y^i is the estimated value, yi is the actual value, and n is the total amount of data.(2) FSIM. FSIM evaluates the image quality by using the phase consistency (PC) feature and the gradient magnitude (GM) feature. The higher the value, the better the image quality. The calculation of PC is shown in(37)PCx=∑jEθjxε+∑n∑jAn,θjx.In (37), x represents a pixel, θj is the direction angle of the filter, Eθj is the energy for direction θj, ε is a smaller constant, and An,θjθj is the amplitude of the direction. Gradient information GM of the image is counted by(38)GM=Gx2+Gy2.In (38), Gx,Gy are the gradient values in the horizontal and vertical directions, respectively. FSIM is coupled by PC and GM. For two images F1 and F2, the similarity is calculated by(39)SPCx=2PC1x⋅PC2x+T1PC12x+PC22x+T1.In (39), PC1,PC2 are the phase consistency of the two pictures, and T1 is a constant. The similarity of GM is calculated by(40)SGMx=2GM1x⋅GM2x+T2GM12x+GMx+T2.In (40), GM1,GM2 are the gradient information values of the two graphs and T2 is a constant. The similarity of the fusion is defined by(41)SLx=SPCxα⋅SGMxβ.In (41), α,β are set to 1 and FSIM of the image is calculated by(42)FSIM=∑x∈ΩSLx⋅PCmx∑x∈ΩPCmx.In (42), Ω is the whole airspace of the image and PCm is calculated by(43)PCm=maxPC1x,PC2x.(3) GMSD. GMSD measures the image quality by calculating the standard deviation of local image quality. The higher the value, the worse the image quality. Gradient amplitude can reflect structural information and set it as a feature, and the prediction score of picture quality can be obtained more accurately. The Prewitt operator is used to obtain gradient information and convolved with the reference image r and the distorted image d to obtain the gradients of two images in the horizontal and vertical directions. mr and md of the gradient amplitude of the image at position i are counted by(44)mri=r⊗hx2i+r⊗hy2i.(45)mdi=d⊗hx2i+d⊗hy2i.In (44) and (45), ⊗ is convolution operation, and hx,hy are Prewitt operators along with directions x and y. The gradient magnitude similarity (GMS) of the image is calculated by(46)GMSi=2mrimdi+cmr2i+md2i+c.In (46), c is a constant. The equation for calculating the gradient magnitude similarity mean (GMSM) is(47)GMSM=1N∑i=1NGMSi.In (47), N is the total number of pixels in the image. Gradient amplitude similarity deviation GMSD is calculated by(48)GMSD=1N∑i=1NGMSi−GMSM2.


## 2.4.1. The Validity Test of the Handwritten Character Recognition Model Based on GIST and PHOG

(1) Selection of Datasets. The effectiveness of the recognition model proposed will be verified by using printed word images and calligraphy word images which are difficult to recognize. System standard fonts and Chinese character book sub-library from China-America Digital Academic Library (CADAL) [19] are selected, respectively. CADAL collects nearly 3.5 million books, including books, calligraphy works, and dissertations. Five fonts, regular script, running script, seal script, official script, and cursive script, are selected from the two fonts, respectively, and the number of pictures in each font is 3,000. 80% are used as training sets, and the remaining 20% as test sets.(2) Specific Experimental Methods. The recognition model runs on the hardware platform of 3.40 GHz CPU and 8G memory, and is implemented on Matlab B2016a simulation software. The main method is to extract the features of characters in images by using the method based on the fusion features of GIST and PHOG, to fuse the two features by the serial fusion, then to reduce the dimension of features by PCA, and finally to output the recognition results. The recognition results of this model are compared with the features of single GIST and PHOG.


## 2.4.2. The Validity Verification of the Automatic Generation Model of an Artistic Typeface Based on GAN

(1) Selection of Datasets. Pencil sketches and calligraphy images are used as models and input objects to verify the validity of the model by generating the “huaniao typeface,” known as the treasure of traditional Chinese art (The word huaniao typeface got its name because of its multi-stroke flower and the bird pattern. This writing form takes characters as the carrier and replaces the strokes of characters with patterns of flowers, birds, grass, fish, insects, mountains, water, and spirals. This font type is drawn in multicolor and formed according to the basic glyphs, which integrates painting and calligraphy. This typeface gives a richer picture than a single ink drawing.). When training the model, the training set will consist of two parts: the source domain (pencil sketch image and calligraphy character image) and the target domain (the huaniao typeface image) image dataset. The resolution of all images is uniformly adjusted to 256∗256.This study searched and downloaded a total of 1200 images of the huaniao typeface corresponding to 372 common Chinese characters on the Internet. The first 1000 images are used as the training set, and the last 200 images are used as the test set to validate the model. The pencil sketch image dataset is mainly obtained by processing the huaniao mentionedabove typeface dataset through the pencil image generation algorithm based on the convolutional neural network (CNN) proposed by Cai and Song to generate the corresponding pencil sketch image. The CNN algorithm can not only generate pencil sketches from natural images but also preserve the tones of natural images, and the painting style is flexible. Pen sketch images are correspondingly distorted and deformed to make their forms richer and more diverse [20]. The calligraphy character image data set is a black and white processing and a certain distortion and deformation to simulate the input image. In the process of using neural network technology, the computing power of neural network technology is improved through repeated training, and the comprehensive effect of the model is improved.(2) Specific Experimental Methods. The computer processor used in the experiment is Intel (R) Core (TM) i7-7700k CPU @ 4.20ghz, the graphics processor is GeForce GTX 1080 Ti, and the memory size is 11 GB. One thousand pencil sketches, calligraphy images, and their corresponding flower-and-bird images are selected from the training set established above to train the GAN model. The model is tested with the test set after training. Finally, the model’s validity is measured by calculating the similarity between the generated image and the original image. Other existing algorithms, such as convolutional neural networks (CNN) [21], cycle-consistent predictive networks (CycleCAN) [22], pixel-to-pixel (Pix2Pix) [23] and pixel-to-pixel high definition (Pix2pixHD) [24], are selected for comparative analysis.


## 2.4.3. Evaluation Indicators

SS, PSNR (peak signal to noise ratio), FSIM (feature similarity), and GMSD (gradient magnitude similarity deviation) are selected as the evaluation indexes of the model. The definition and calculation of each index are as follows:(1) PSNR. Because the image is compressed in the process of output, there will be some differences between it and the original image. PSNR is used to measure the quality of the processed image. The larger the value, the less the image distortion. The equation of PSNR is as follows:(35)PSNR=10×log102n−12MSE.In (35), n is the number of bits of each sampling value, and MSE is mean square error, which is a measure reflecting the degree of difference between the estimated quantity and the estimated quantity. MSE is calculated by(36)MSE=1n∑i=1ny⌢i−yi2.In (36), y^i is the estimated value, yi is the actual value, and n is the total amount of data.(2) FSIM. FSIM evaluates the image quality by using the phase consistency (PC) feature and the gradient magnitude (GM) feature. The higher the value, the better the image quality. The calculation of PC is shown in(37)PCx=∑jEθjxε+∑n∑jAn,θjx.In (37), x represents a pixel, θj is the direction angle of the filter, Eθj is the energy for direction θj, ε is a smaller constant, and An,θjθj is the amplitude of the direction. Gradient information GM of the image is counted by(38)GM=Gx2+Gy2.In (38), Gx,Gy are the gradient values in the horizontal and vertical directions, respectively. FSIM is coupled by PC and GM. For two images F1 and F2, the similarity is calculated by(39)SPCx=2PC1x⋅PC2x+T1PC12x+PC22x+T1.In (39), PC1,PC2 are the phase consistency of the two pictures, and T1 is a constant. The similarity of GM is calculated by(40)SGMx=2GM1x⋅GM2x+T2GM12x+GMx+T2.In (40), GM1,GM2 are the gradient information values of the two graphs and T2 is a constant. The similarity of the fusion is defined by(41)SLx=SPCxα⋅SGMxβ.In (41), α,β are set to 1 and FSIM of the image is calculated by(42)FSIM=∑x∈ΩSLx⋅PCmx∑x∈ΩPCmx.In (42), Ω is the whole airspace of the image and PCm is calculated by(43)PCm=maxPC1x,PC2x.(3) GMSD. GMSD measures the image quality by calculating the standard deviation of local image quality. The higher the value, the worse the image quality. Gradient amplitude can reflect structural information and set it as a feature, and the prediction score of picture quality can be obtained more accurately. The Prewitt operator is used to obtain gradient information and convolved with the reference image r and the distorted image d to obtain the gradients of two images in the horizontal and vertical directions. mr and md of the gradient amplitude of the image at position i are counted by(44)mri=r⊗hx2i+r⊗hy2i.(45)mdi=d⊗hx2i+d⊗hy2i.In (44) and (45), ⊗ is convolution operation, and hx,hy are Prewitt operators along with directions x and y. The gradient magnitude similarity (GMS) of the image is calculated by(46)GMSi=2mrimdi+cmr2i+md2i+c.In (46), c is a constant. The equation for calculating the gradient magnitude similarity mean (GMSM) is(47)GMSM=1N∑i=1NGMSi.In (47), N is the total number of pixels in the image. Gradient amplitude similarity deviation GMSD is calculated by(48)GMSD=1N∑i=1NGMSi−GMSM2.


## 3. Results of the Model Test

### 3.1. Test Results of the Handwritten Recognition Model Based on Generalized Search Trees and Pyramid Histogram of Oriented Gradient

#### 3.1.1. The Recognition Result of the Dataset of the Model on the System Standard Font

The recognition result of the handwritten character recognition model based on GIST and PHOG on the system standard font dataset is shown in Figure6.Figure 6
Test results of the recognition accuracy rate of five system standard fonts by the model. (a) Comparison of the recognition accuracy rate of the model under different training samples; (b) comparison of the recognition accuracy rate of five system standard fonts by the model; (c) comparison of identification time of five system standard fonts by the model.
(a)(b)(c)Figure6 shows that when the number of training samples is 1000, the recognition accuracy of the fonts of the three methods tends to be stable. The average recognition accuracy rates of GIST and PHOG for five system standard fonts are 95.47% and 93.27%, respectively. The average recognition accuracy of the GIST and PHOG fusion feature method designed is 99.27%, which is higher than the other two methods by more than 6.4%. According to the comparison of the recognition time of the three methods, the total time of GIST and PHOG is 0.87559s and 1.13666s, respectively, and the total time of this model proposed is only 0.44275 s, which is 49.4% lower than the other two methods.


#### 3.1.2. The Recognition Results of the Dataset of the Model on the CADAL Font

The recognition result of the model on the dataset of the CADAL font is shown in Figure7.Figure 7
Test results of the recognition accuracy rate of five CADAL calligraphy fonts by the model. (a) Comparison of the recognition accuracy rate of the model under different training samples; (b) comparison of the recognition accuracy rate of five system standard fonts by the model; (c) comparison of the recognition time of five CADAL calligraphy fonts by the model.
(a)(b)(c)Figure7 shows that when the number of training samples is 1000, the correct rate of font recognition of the three methods tends to be stable. The average recognition accuracy of GIST and PHOG for five CADAL calligraphy fonts is 92.4% and 90.13%, respectively. The average recognition accuracy of the GIST and PHOG fusion feature method proposed is 95.33%, which is 5.8% higher than the other two methods. According to the comparison of recognition time, the total time of GIST and PHOG is 0.74665 s and 1.84479 s, respectively, and the total time of this model designed is only 0.36629 s, which is over 50.9% lower than the other two methods.


### 3.2. Simulation Results of the Algorithm

#### 3.2.1. Test Results on Pencil Sketch Image Datasets

In order to reflect the comprehensive performance of the designed model, the proposed model is evaluated and compared with other methods, including CNN, CycleCAN, Pix2Pix, and Pix2PixHD. The test results of the five algorithms GAN, CNN, CycleCAN, Pix2Pix, and Pix2PixHD on the pencil sketch image dataset are shown in Figure8.Figure 8
Test results of five algorithms on pencil sketch image datasets.As mentioned above, the larger the values of PSNR, SS, and FSIM are, the smaller the value of GMSD and the better the quality of the generated image. Figure8 shows that the performance of optimized GAN proposed is better, and the values of PSNR, SS, and FSIM are higher than those of other popular algorithms by more than 5.53%, 4.54%, and 0.08%, respectively. The value of GMSD is lower than other algorithms by more than 17.13%. Therefore, based on the pencil sketch image datasets, the quality of flower-and-bird character images generated by the optimized GAN algorithm is better.


#### 3.2.2. Test Results on Chinese Calligraphy Image Datasets

The test results of GAN, CNN, CycleCAN, Pix2Pix, and Pix2PixHD on the Chinese calligraphy image datasets are shown in Figure9.Figure 9
Test results of five algorithms on Chinese calligraphy image datasets.In Figure9, the PSNR, SS, and FSIM values of the proposed optimized GAN algorithm are higher than those of the other four popular algorithms by 2.5%, 1.2%, and 6.37%, respectively. GMSD is lower than the other four algorithms by more than 5.82%. The data shows that the image quality of huaniao characters generated from calligraphy character images is higher. The proposed GAN-based automatic artistic typeface generation model has a better performance than other popular algorithms in both the pencil sketch and calligraphy character image datasets. The proposed algorithm has broad application prospects in the contemporary advertising text art design.


#### 3.2.3. Analysis Results of the Loss Function

The SS loss term is added to the traditional GAN model order to improve the quality of the generated artistic typeface image. The original model and the model without the SS term are used to make experiments, respectively, to verify the model. The average evaluation results of the model on two datasets with and without SS terms are shown in Figure10.Figure 10
Test results of the model with and without the SS term. (a) Average evaluation results on pencil sketch image data; (b) average evaluation results on the image data of Chinese calligraphy.
(a)(b)Figure10 shows that the values of PNSR, SS, and FSIM on the pencil sketch image dataset decreases by 12.34%, 4.0%, and 3.0%, respectively, and the value of GMSD increases by 25.62%. For the Chinese calligraphy image dataset, the values of PNSR, SS, and FSIM decreases by 20.32%, 5.79%, and 6.0%, respectively, and the value of GMSD increases by 27.47%. In short, after the SS loss term is added to the model, the quality of the generated flower-and-bird character image is improved, and the model has an excellent generation performance of artistic characters.


### 3.3. Discussion

Based on the deep learning network technology of the Internet of Things, the design method of contemporary advertising text art is optimized, thereby improving the comprehensive effect of the contemporary advertising text art design. The results show that during the training and evaluation of the five standard fonts of the designed model, when the number of training samples is 1000, the correct rate of font recognition of the three methods tends to be stable. The average accuracy rates of GIST and PHOG features for five system standard fonts are 95.47% and 93.27%, respectively. The average recognition accuracy of the designed GIST and PHOG fusion feature method is 99.27%, which is more than 6.4% higher than the other two methods. In comparing the recognition time of the three methods, the total time for the recognition of GIST and PHOG features is 0.87559 s and 1.13666 s, respectively. The total model time is only 0.44275 s, which is more than 49.4% lower than the other two methods. During the training and evaluation of five CADAL calligraphy fonts, when the number of training samples is 1000, the correct rate of font recognition of the three methods tends to be relatively stable. The average recognition accuracy of GIST and PHOG features for five CADAL calligraphy fonts is 92.4% and 90.13%, respectively. The average recognition accuracy of the proposed GIST and PHOG fusion feature method is 95.33%, which is more than 5.8% higher than the other two methods. In the comparison of recognition time, the total time of GIST and PHOG feature recognition is 0.74665 s and 1.84479 s, respectively. The total time of the designed model is only 0.36629 s, which is more than 50.9% lower than the other two methods. Meanwhile, when comparing training with other methods, the test results on the pencil sketch image dataset show that the proposed optimized GAN algorithm performs better. The values of PSNR, SS, and FSIM are higher than other popular algorithms by more than 5.53%, 4.54%, and 0.08%, respectively. The value of GMSD is lower than other algorithms by more than 17.13%. Based on the pencil sketch image dataset, the image quality of huaniao characters generated by the proposed optimized GAN algorithm is better. The test results on the calligraphy character image dataset show that the PSNR, SS, and FSIM of the proposed optimized GAN algorithm are 2.5%, 1.2%, and 6.37%, respectively, higher than the other four popular algorithms; GMSD is lower than the other four algorithms by 5.82%. The data shows that the proposed model generates higher quality images of huaniao characters from calligraphy character images. The designed model can not only effectively carry out various artistic designs, but also the performance of the model is better than other models.


## 3.1. Test Results of the Handwritten Recognition Model Based on Generalized Search Trees and Pyramid Histogram of Oriented Gradient

### 3.1.1. The Recognition Result of the Dataset of the Model on the System Standard Font

The recognition result of the handwritten character recognition model based on GIST and PHOG on the system standard font dataset is shown in Figure6.Figure 6
Test results of the recognition accuracy rate of five system standard fonts by the model. (a) Comparison of the recognition accuracy rate of the model under different training samples; (b) comparison of the recognition accuracy rate of five system standard fonts by the model; (c) comparison of identification time of five system standard fonts by the model.
(a)(b)(c)Figure6 shows that when the number of training samples is 1000, the recognition accuracy of the fonts of the three methods tends to be stable. The average recognition accuracy rates of GIST and PHOG for five system standard fonts are 95.47% and 93.27%, respectively. The average recognition accuracy of the GIST and PHOG fusion feature method designed is 99.27%, which is higher than the other two methods by more than 6.4%. According to the comparison of the recognition time of the three methods, the total time of GIST and PHOG is 0.87559s and 1.13666s, respectively, and the total time of this model proposed is only 0.44275 s, which is 49.4% lower than the other two methods.


### 3.1.2. The Recognition Results of the Dataset of the Model on the CADAL Font

The recognition result of the model on the dataset of the CADAL font is shown in Figure7.Figure 7
Test results of the recognition accuracy rate of five CADAL calligraphy fonts by the model. (a) Comparison of the recognition accuracy rate of the model under different training samples; (b) comparison of the recognition accuracy rate of five system standard fonts by the model; (c) comparison of the recognition time of five CADAL calligraphy fonts by the model.
(a)(b)(c)Figure7 shows that when the number of training samples is 1000, the correct rate of font recognition of the three methods tends to be stable. The average recognition accuracy of GIST and PHOG for five CADAL calligraphy fonts is 92.4% and 90.13%, respectively. The average recognition accuracy of the GIST and PHOG fusion feature method proposed is 95.33%, which is 5.8% higher than the other two methods. According to the comparison of recognition time, the total time of GIST and PHOG is 0.74665 s and 1.84479 s, respectively, and the total time of this model designed is only 0.36629 s, which is over 50.9% lower than the other two methods.


## 3.1.1. The Recognition Result of the Dataset of the Model on the System Standard Font

The recognition result of the handwritten character recognition model based on GIST and PHOG on the system standard font dataset is shown in Figure6.Figure 6
Test results of the recognition accuracy rate of five system standard fonts by the model. (a) Comparison of the recognition accuracy rate of the model under different training samples; (b) comparison of the recognition accuracy rate of five system standard fonts by the model; (c) comparison of identification time of five system standard fonts by the model.
(a)(b)(c)Figure6 shows that when the number of training samples is 1000, the recognition accuracy of the fonts of the three methods tends to be stable. The average recognition accuracy rates of GIST and PHOG for five system standard fonts are 95.47% and 93.27%, respectively. The average recognition accuracy of the GIST and PHOG fusion feature method designed is 99.27%, which is higher than the other two methods by more than 6.4%. According to the comparison of the recognition time of the three methods, the total time of GIST and PHOG is 0.87559s and 1.13666s, respectively, and the total time of this model proposed is only 0.44275 s, which is 49.4% lower than the other two methods.


## 3.1.2. The Recognition Results of the Dataset of the Model on the CADAL Font

The recognition result of the model on the dataset of the CADAL font is shown in Figure7.Figure 7
Test results of the recognition accuracy rate of five CADAL calligraphy fonts by the model. (a) Comparison of the recognition accuracy rate of the model under different training samples; (b) comparison of the recognition accuracy rate of five system standard fonts by the model; (c) comparison of the recognition time of five CADAL calligraphy fonts by the model.
(a)(b)(c)Figure7 shows that when the number of training samples is 1000, the correct rate of font recognition of the three methods tends to be stable. The average recognition accuracy of GIST and PHOG for five CADAL calligraphy fonts is 92.4% and 90.13%, respectively. The average recognition accuracy of the GIST and PHOG fusion feature method proposed is 95.33%, which is 5.8% higher than the other two methods. According to the comparison of recognition time, the total time of GIST and PHOG is 0.74665 s and 1.84479 s, respectively, and the total time of this model designed is only 0.36629 s, which is over 50.9% lower than the other two methods.


## 3.2. Simulation Results of the Algorithm

### 3.2.1. Test Results on Pencil Sketch Image Datasets

In order to reflect the comprehensive performance of the designed model, the proposed model is evaluated and compared with other methods, including CNN, CycleCAN, Pix2Pix, and Pix2PixHD. The test results of the five algorithms GAN, CNN, CycleCAN, Pix2Pix, and Pix2PixHD on the pencil sketch image dataset are shown in Figure8.Figure 8
Test results of five algorithms on pencil sketch image datasets.As mentioned above, the larger the values of PSNR, SS, and FSIM are, the smaller the value of GMSD and the better the quality of the generated image. Figure8 shows that the performance of optimized GAN proposed is better, and the values of PSNR, SS, and FSIM are higher than those of other popular algorithms by more than 5.53%, 4.54%, and 0.08%, respectively. The value of GMSD is lower than other algorithms by more than 17.13%. Therefore, based on the pencil sketch image datasets, the quality of flower-and-bird character images generated by the optimized GAN algorithm is better.


### 3.2.2. Test Results on Chinese Calligraphy Image Datasets

The test results of GAN, CNN, CycleCAN, Pix2Pix, and Pix2PixHD on the Chinese calligraphy image datasets are shown in Figure9.Figure 9
Test results of five algorithms on Chinese calligraphy image datasets.In Figure9, the PSNR, SS, and FSIM values of the proposed optimized GAN algorithm are higher than those of the other four popular algorithms by 2.5%, 1.2%, and 6.37%, respectively. GMSD is lower than the other four algorithms by more than 5.82%. The data shows that the image quality of huaniao characters generated from calligraphy character images is higher. The proposed GAN-based automatic artistic typeface generation model has a better performance than other popular algorithms in both the pencil sketch and calligraphy character image datasets. The proposed algorithm has broad application prospects in the contemporary advertising text art design.


### 3.2.3. Analysis Results of the Loss Function

The SS loss term is added to the traditional GAN model order to improve the quality of the generated artistic typeface image. The original model and the model without the SS term are used to make experiments, respectively, to verify the model. The average evaluation results of the model on two datasets with and without SS terms are shown in Figure10.Figure 10
Test results of the model with and without the SS term. (a) Average evaluation results on pencil sketch image data; (b) average evaluation results on the image data of Chinese calligraphy.
(a)(b)Figure10 shows that the values of PNSR, SS, and FSIM on the pencil sketch image dataset decreases by 12.34%, 4.0%, and 3.0%, respectively, and the value of GMSD increases by 25.62%. For the Chinese calligraphy image dataset, the values of PNSR, SS, and FSIM decreases by 20.32%, 5.79%, and 6.0%, respectively, and the value of GMSD increases by 27.47%. In short, after the SS loss term is added to the model, the quality of the generated flower-and-bird character image is improved, and the model has an excellent generation performance of artistic characters.


## 3.2.1. Test Results on Pencil Sketch Image Datasets

In order to reflect the comprehensive performance of the designed model, the proposed model is evaluated and compared with other methods, including CNN, CycleCAN, Pix2Pix, and Pix2PixHD. The test results of the five algorithms GAN, CNN, CycleCAN, Pix2Pix, and Pix2PixHD on the pencil sketch image dataset are shown in Figure8.Figure 8
Test results of five algorithms on pencil sketch image datasets.As mentioned above, the larger the values of PSNR, SS, and FSIM are, the smaller the value of GMSD and the better the quality of the generated image. Figure8 shows that the performance of optimized GAN proposed is better, and the values of PSNR, SS, and FSIM are higher than those of other popular algorithms by more than 5.53%, 4.54%, and 0.08%, respectively. The value of GMSD is lower than other algorithms by more than 17.13%. Therefore, based on the pencil sketch image datasets, the quality of flower-and-bird character images generated by the optimized GAN algorithm is better.


## 3.2.2. Test Results on Chinese Calligraphy Image Datasets

The test results of GAN, CNN, CycleCAN, Pix2Pix, and Pix2PixHD on the Chinese calligraphy image datasets are shown in Figure9.Figure 9
Test results of five algorithms on Chinese calligraphy image datasets.In Figure9, the PSNR, SS, and FSIM values of the proposed optimized GAN algorithm are higher than those of the other four popular algorithms by 2.5%, 1.2%, and 6.37%, respectively. GMSD is lower than the other four algorithms by more than 5.82%. The data shows that the image quality of huaniao characters generated from calligraphy character images is higher. The proposed GAN-based automatic artistic typeface generation model has a better performance than other popular algorithms in both the pencil sketch and calligraphy character image datasets. The proposed algorithm has broad application prospects in the contemporary advertising text art design.


## 3.2.3. Analysis Results of the Loss Function

The SS loss term is added to the traditional GAN model order to improve the quality of the generated artistic typeface image. The original model and the model without the SS term are used to make experiments, respectively, to verify the model. The average evaluation results of the model on two datasets with and without SS terms are shown in Figure10.Figure 10
Test results of the model with and without the SS term. (a) Average evaluation results on pencil sketch image data; (b) average evaluation results on the image data of Chinese calligraphy.
(a)(b)Figure10 shows that the values of PNSR, SS, and FSIM on the pencil sketch image dataset decreases by 12.34%, 4.0%, and 3.0%, respectively, and the value of GMSD increases by 25.62%. For the Chinese calligraphy image dataset, the values of PNSR, SS, and FSIM decreases by 20.32%, 5.79%, and 6.0%, respectively, and the value of GMSD increases by 27.47%. In short, after the SS loss term is added to the model, the quality of the generated flower-and-bird character image is improved, and the model has an excellent generation performance of artistic characters.


## 3.3. Discussion

Based on the deep learning network technology of the Internet of Things, the design method of contemporary advertising text art is optimized, thereby improving the comprehensive effect of the contemporary advertising text art design. The results show that during the training and evaluation of the five standard fonts of the designed model, when the number of training samples is 1000, the correct rate of font recognition of the three methods tends to be stable. The average accuracy rates of GIST and PHOG features for five system standard fonts are 95.47% and 93.27%, respectively. The average recognition accuracy of the designed GIST and PHOG fusion feature method is 99.27%, which is more than 6.4% higher than the other two methods. In comparing the recognition time of the three methods, the total time for the recognition of GIST and PHOG features is 0.87559 s and 1.13666 s, respectively. The total model time is only 0.44275 s, which is more than 49.4% lower than the other two methods. During the training and evaluation of five CADAL calligraphy fonts, when the number of training samples is 1000, the correct rate of font recognition of the three methods tends to be relatively stable. The average recognition accuracy of GIST and PHOG features for five CADAL calligraphy fonts is 92.4% and 90.13%, respectively. The average recognition accuracy of the proposed GIST and PHOG fusion feature method is 95.33%, which is more than 5.8% higher than the other two methods. In the comparison of recognition time, the total time of GIST and PHOG feature recognition is 0.74665 s and 1.84479 s, respectively. The total time of the designed model is only 0.36629 s, which is more than 50.9% lower than the other two methods. Meanwhile, when comparing training with other methods, the test results on the pencil sketch image dataset show that the proposed optimized GAN algorithm performs better. The values of PSNR, SS, and FSIM are higher than other popular algorithms by more than 5.53%, 4.54%, and 0.08%, respectively. The value of GMSD is lower than other algorithms by more than 17.13%. Based on the pencil sketch image dataset, the image quality of huaniao characters generated by the proposed optimized GAN algorithm is better. The test results on the calligraphy character image dataset show that the PSNR, SS, and FSIM of the proposed optimized GAN algorithm are 2.5%, 1.2%, and 6.37%, respectively, higher than the other four popular algorithms; GMSD is lower than the other four algorithms by 5.82%. The data shows that the proposed model generates higher quality images of huaniao characters from calligraphy character images. The designed model can not only effectively carry out various artistic designs, but also the performance of the model is better than other models.


## 4. Conclusion

Currently, the methods for generating artistic fonts are generally based on standard fonts, and the fonts are blunt and lack novelty. The feature extraction of fonts is also limited to single local feature extraction or global feature extraction, which cannot fully describe the features of a word. Firstly, a handwritten word recognition model based on GIST and PHOG is proposed. Secondly, a GAN-based artistic typeface automatic generation model is constructed. Finally, the generation of the huaniao typeface is taken as an example. The effectiveness of the two models is verified by constructing a dataset. The experimental results show that the proposed handwriting recognition model based on GIST and PHOG has a recognition accuracy rate of more than 5.8% for different fonts, which is more than 5.8% higher than that of single GIST and PHOG features. The total recognition time is more than 49.4% lower, and the performance is improved significantly. Compared with other popular algorithms, the constructed GAN-based automatic artistic typeface generation model has the best quality of the generated huaniao typeface on both the pencil sketch and the calligraphy character image dataset. The proposed model has broad application prospects in the contemporary advertising text art design. The limitations include: when testing the GAN model, the datasets used are all self-created, and only one font of huaniao is used as an example, which is not representative enough. Whether the model can use other datasets to generate other styles of the artistic typeface remains to be further studied in the future. Therefore, future studies will carry out the automatic design technology of contemporary advertising text art and provide important technical support for improving the overall efficiency of the advertising font design.



---

*Source: 5161398-2022-07-22.xml*