Image processing has always been one of the key research directions of deep learning.At present,different neural network structures can be constructed to complete tasks such as image recognition,super-resolution image reconstruction,and image translation.However,the font style transfers,especially Chinese characters.Research on font style migration is relatively small.Different from English characters,the structure of Chinese character fonts is complex and numerous.There are 27533 Chinese characters in the official GB18030 data set,and there are more than 3000 commonly used Chinese characters.As the most populated character in the world,Chinese characters are widely circulated all over the world,and have a certain influence on the font morphology of Korean and Japanese.Therefore,it is of great significance to study the style transfer of Chinese characters.First,this article compares and analyzes the classic style transfer network: Pix2 pix network and cyclic uniform generative confrontation network.Under the same experimental conditions,it is found that although the two networks can complete the conversion of Song Ti to calligraphy fonts,the Pix2 pix network requires paired data sets for training,which is difficult to obtain in real life,so this article chooses the cycle consistent generation The confrontation network serves as the basic model.Then,this paper improves on the basis of the cyclic uniform generative confrontation network.The main improvements include: First,draw on the Wasserstein-CycleGAN network proposed in GitHub in 2018,introduce Wasserstein distance instead of JS divergence to measure the distance between the generated distribution and the real distribution,and solve the gradient disappearance of the network during the training process.problem.Second,add perceptual style loss.Use the pre-trained VGG-16 network as the perceptual style loss network,take the generated image and the real image as the input of the network,calculate the difference between their feature values in each convolutional layer,and use this as the perceptual style loss of the network.Finally,in order to verify the improvements made in this article,a cyclically consistent generative confrontation network and an improved network model were built under the TensorFlow deep learning framework,and a Chinese database was established for training.Experimental results show that although both networks can generate calligraphic fonts,the improved network generates higher image quality and faster convergence.This paper uses an improved generative confrontation network to realize the generation of different styles of Chinese fonts,which solves the problem of long time to create traditional fonts and the need for a lot of manpower and financial resources.In order to apply the generated fonts to real life,this article first uses the Opencv open source visual software library to binarize the generated font images.Then,use the Findcontours function to extract the contours of the Chinese characters,get the coordinates of each pixel,and store them in different paths according to the strokes.Finally,analyze the kinematics of the robotic arm used for writing Chinese characters,convert the coordinates of each pixel point into each joint angle,and call the robot arm controller port through the Visusal Studio platform,and use each joint angle as the input of the controller to control the machine The arm realizes the writing of Chinese characters. |