Image processing method and system
By calling the Python deep learning model from Java, combined with UUID encoding and attention mechanism network, the problem of Java calling Python to process complex images is solved, efficient image processing without login is achieved, and image quality and processing speed are improved.
Patent Information
- Application Number
- CN202210011967.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-06
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2042-01-06
AI Technical Summary
In the existing technology, the method of using Java to call Python to process user-uploaded pictures and return them to the front end is difficult to handle complex situations and lacks a clear technical solution.
Using Java language background program combined with Python deep learning model, through UUID encoding and standardized naming, an attention mechanism network model is established to perform image preprocessing, encoding and deep learning, and an image processing method that generates a unique identification code is implemented to achieve autonomous learning of batch files.
It ensures the uniqueness and efficiency of image processing without the need for user login, improves the speed and accuracy of image processing, and enhances image quality through adaptive processing of deep learning models.
Smart Images

Figure CN114399561B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing, and in particular to an image processing method and system. Background Art
[0002] In the field of image processing, Java-based Spring architecture systems are the most widely used. In the era of artificial intelligence, centered around neural networks and deep learning, Python is the primary application language. After batches of training, models are generated and then called from Python. However, calling Python from Java in the backend to process user-uploaded images and then returning them to the frontend presents a technical challenge. Currently, the Java-based Python call method is relatively simple and can only handle relatively simple cases. However, there remains a lack of clear technical solutions for returning Python-processed images to frontend users. Summary of the Invention
[0003] In view of the problems existing in the prior art, the present invention discloses an image processing method, comprising:
[0004] The front terminal receives the input image and reads the image information, performs denoising and binarization preprocessing on the image and then outputs it;
[0005] The back-end receives the pre-processed image, reads the user's processing request, performs a unique identification encoding operation on the image, and assigns a standardized name to the encoded image;
[0006] Perform deep learning on the entire processing step and establish an attention mechanism network model, train and save the model, execute the batch file in the above manner, and input the image name as parameter information in the batch file to complete the image processing process;
[0007] Add identification codes to the processed images and save them in the local disk;
[0008] The back terminal transmits the picture with the identification code to the front terminal and then transmits it to the user.
[0009] When preprocessing an image, the pixel value of each pixel in the image is traversed and the grayscale value is calculated. The image is converted into a grayscale image by processing each pixel, and then the image is binarized. An adaptive threshold method is used to set the value of pixels greater than the threshold to 255, and the value of pixels less than the threshold to 0.
[0010] A unique 32-bit encoding operation is used when encoding the image.
[0011] When training the attention mechanism network model: first, resize the image to a preset range, perform multiple sets of channel attention and spatial attention operations with a stride of 2 on the image, then perform continuous downsampling, upsampling and convolution operations on the image, and finally perform multiple sets of convolution, channel and spatial attention operations to generate the output image.
[0012] Standardized naming of images is unique, and similarly all images are unique.
[0013] An image processing system, comprising:
[0014] The front terminal receives the picture input by the user;
[0015] The preprocessing module performs preprocessing operations on the images transmitted by the front-end terminal, including denoising and binarization;
[0016] The back-end receives the pre-processed image transmitted by the pre-processing module, reads the user's processing request, performs a unique identification encoding operation on the image, and standardizes the name of the encoded image;
[0017] The deep learning module performs deep learning on the entire processing link to establish an attention mechanism network model, trains and saves the model, and executes the batch file in the same way as the back-end. In the batch file, the image name is input as parameter information to complete the image processing process;
[0018] The storage module adds identification codes to the images processed by the deep learning module and saves them in the local disk;
[0019] The output module receives the picture with the identification code transmitted by the rear terminal, outputs it to the front terminal, and then transmits it to the user.
[0020] Due to the adoption of the above technical solution, the present invention provides an image processing method and system, in which the method adopted adopts a new Java calling Python mode, and calls the deep learning model in Python to perform autonomous learning operations on batch files, and uses batch files to execute Python programs to ensure the speed and accuracy of the image processing process. In addition, in this method, by performing unique identification encoding and standardized naming operations on the images, the user can ensure the uniqueness of the images and the processed images without logging in. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments recorded in this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0022] Figure 1 A schematic diagram of an embodiment of the method of the present invention;
[0023] Figure 2 It is a structural block diagram of the system of the present invention;
[0024] Figure 3 Schematic diagram of an embodiment of the present invention. DETAILED DESCRIPTION
[0025] To make the technical solutions and advantages of the present invention more clear, the technical solutions in the embodiments of the present invention are clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention:
[0026] The present invention discloses an image processing method, which specifically includes the following steps:
[0027] S1: The front terminal receives the input image and reads the image information, performs denoising and binarization preprocessing on the image and then outputs it;
[0028] S2: The rear terminal receives the pre-processed image, reads the user's processing request, performs a unique identification encoding operation on the image, and performs a standardized naming on the encoded image;
[0029] S3: Perform deep learning on the entire processing step, establish an attention mechanism network model, train and save the model, execute the batch file in the above manner, and input the image name as parameter information in the batch file to complete the image processing process;
[0030] The specific process is: based on UNet 8 Network architecture, add attention mechanism, build a network structure, first resize the input image to 192*192, perform 5 sets of 3*3*128 convolution with a step size of 2 and channel attention and spatial attention operations, then perform 7 consecutive 3*3*64 downsampling, then perform 7 upsampling and convolution operations, and finally perform 5 sets of convolution and channel and spatial attention operations, and generate the output image through 3*3*3 convolution.
[0031] S4: adding an identification code to the processed image and saving it in a local disk;
[0032] S5: The rear terminal transmits the picture with the identification code to the front terminal and then transmits it to the user.
[0033] Furthermore, when preprocessing the image, the pixel value of each pixel of the image is traversed and the grayscale value is calculated. The image is converted into a grayscale image by processing each pixel, and then the image is binarized. An adaptive threshold method is used to set the value of the pixel points greater than the threshold to 255, and the value of the pixel points less than the threshold to 0.
[0034] Furthermore, a unique 32-bit encoding operation is used when encoding the image.
[0035] Furthermore, the standardized naming of pictures is unique, and similarly all pictures are unique.
[0036] Example: This invention discloses an image processing method that uses a Java backend program and a Python deep learning model to process images and return the processed images to the frontend user without requiring login. The frontend interface is developed using Vue. Users complete the image processing process in a single request and response interaction, without requiring a username. First, the user initiates a request on the frontend and uploads an image to be processed. The Java backend receives the image and encodes it with a unique 32-bit UUID, which is then used to name the image. The backend program first creates a batch file (an executable file) that solidifies the entire processing process. Java then opens a command prompt (CMD) command line and executes the batch file. Within the batch file, a Python file is executed, passing the image UUID as a parameter. The Python file then calls the deep learning model as needed. The Python program executes within the CMD command line to process the images, marking the corresponding images during processing. After processing, the marked processed files are written to the local disk. The CMD command line then exits, returning to the Java backend program. The backend program searches the directory for the corresponding files and returns them to the frontend user. Due to the uniqueness of the UUID, all files are unique. Returned in the response, this way, image processing is completed in one front-end and back-end interaction, and the user does not need to log in.
[0037] Example: The attention mechanism network model established by this method has better effects when performing low-light enhancement processing on images. Refer to the following example:
[0038] This experiment used the TensorFlow deep learning framework, Python version 3.6, an i5 processor with a 3.1GHz clock speed and 24GB of RAM. All deep learning methods were trained for 20 epochs. The evaluation metrics used in this paper were mean squared error (MSE), peak signal-to-noise ratio (PSNR), and structural similarity (SSIM).
[0039] Test index: For MSE, the calculation formula is shown in (1), which is the mean square error between the calculated image and the real image. The smaller the data, the better.
[0040]
[0041] For PSNR, as shown in formula (2), mse refers to mean square error, max is the maximum value of the pixel, and the unit is dB. The smaller the value, the greater the distortion, and the larger the value, the smaller the distortion.
[0042]
[0043] For SSIM, as shown in formula (3), μ x and μ y are the mean values of the images, and is the variance of the image, σ xy is the covariance of the image. The closer SSIM is to 1, the closer the images are.
[0044]
[0045] Experimental results
[0046] Fifteen images from the LOL dataset were used as low-light and normal image comparisons to test the MSE, PSNR, and SSIM indicators, as shown in Table (1). As can be seen from the table, Lime performed better among the traditional algorithms. After the same 20 batches of training, the deep learning GladNet method outperformed RetinexNet, and GladNet plus CBAM achieved the best results.
[0047] Table (1) Test results of relevant indicators of LOL dataset
[0048]
[0049]
[0050] Summary: If Figure 3As shown in the last row (ours represents the example image of this method), this paper compares traditional algorithms for low-light image enhancement such as histogram equalization, MSR, LIME, and deep learning algorithms such as RetinexNet and GladNet, analyzes their algorithm principles, introduces the attention mechanism, and combines the Unet network structure to propose a neural network model. Based on the MSE, PSNR, and SSIM indicators of the LOL dataset experiment, the low-light image enhancement effect is improved in terms of both visual effects and test indicators.
[0051] An image processing system, comprising:
[0052] The front terminal receives the picture input by the user;
[0053] The preprocessing module performs preprocessing operations on the images transmitted by the front-end terminal, including denoising and binarization;
[0054] The back-end receives the pre-processed image transmitted by the pre-processing module, reads the user's processing request, performs a unique identification encoding operation on the image, and standardizes the name of the encoded image;
[0055] The deep learning module performs deep learning on the entire processing link to establish an attention mechanism network model, trains and saves the model, and executes the batch file in the same way as the back-end. In the batch file, the image name is input as parameter information to complete the image processing process;
[0056] The storage module adds identification codes to the images processed by the deep learning module and saves them in the local disk;
[0057] The output module receives the picture with the identification code transmitted by the rear terminal, outputs it to the front terminal, and then transmits it to the user.
[0058] The above description is only a preferred specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any technician familiar with the technical field, within the technical scope disclosed by the present invention, who makes equivalent replacements or changes based on the technical solution and inventive concept of the present invention, should be covered by the scope of protection of the present invention.
Claims
1. An image processing method, characterized in that include: The front terminal uses a Java language background program to receive input images and read image information, and then performs denoising and binarization preprocessing on the image before outputting it; The back-end receives the pre-processed image, reads the user's processing request, and uses a new Java-to-Python model to call a deep learning model in Python to perform autonomous learning operations on batch files. The batch file is used to execute the Python program, and the processed file is marked in the Python program. The image is uniquely identified and encoded, and the encoded image is given a standardized name. Establish an attention mechanism network model, train and save the model, and use the autonomous learning operation process to execute the batch file. In the batch file, the name of the image is input as parameter information to complete the image processing process; Add identification codes to the processed images and save them in the local disk; The back terminal transmits the picture with the identification code to the front terminal and then transmits it to the user.
2. The image processing method according to claim 1, wherein: When preprocessing an image, the pixel value of each pixel in the image is traversed and the grayscale value is calculated. The image is converted into a grayscale image by processing each pixel, and then the image is binarized. An adaptive threshold method is used to set the value of pixels greater than the threshold to 255, and the value of pixels less than the threshold to 0.
3. The image processing method according to claim 1, wherein: A unique 32-bit encoding operation is used when encoding the image.
4. The image processing method according to claim 1, wherein: When training the attention mechanism network model: first, resize the image to a preset range, perform multiple sets of channel attention and spatial attention operations with a stride of 2 on the image, then perform continuous downsampling, upsampling and convolution operations on the image, and finally perform multiple sets of convolution, channel and spatial attention operations to generate the output image.
5. The image processing method according to claim 1, wherein: Standardized naming of images is unique, and similarly all images are unique.
6. An image processing system, characterized in that include: The front terminal uses the Java language background program to receive the pictures input by the user; The preprocessing module performs preprocessing operations on the images transmitted by the front-end terminal, including denoising and binarization; The back-end receives the pre-processed image transmitted by the pre-processing module, reads the user's processing request, uses the new Java-to-Python model, calls the deep learning model in Python to perform autonomous learning operations on the batch file, uses the batch file to execute the Python program, and labels the processed file in the Python program, performs a unique identification encoding operation on the image, and standardizes the naming of the encoded image; The deep learning module performs deep learning on the autonomous learning operation to establish an attention mechanism network model, trains and saves the model, and executes the batch file in the same way as the back-end. In the batch file, the name of the image is input as parameter information to complete the image processing process; The storage module adds identification codes to the images processed by the deep learning module and saves them in the local disk; The output module receives the picture with the identification code transmitted by the rear terminal, outputs it to the front terminal, and then transmits it to the user.
Citation Information
Patent Citations
Label-based cloud resource management method and device
CN109981322A
Process optimization method and device based on machine learning, terminal and storage medium
CN111260080A