Image preprocessing method for interactive travel content generation
By adding noise to cultural and tourism images and performing segmentation and model training, and dynamically adjusting the processing strategy, the problem of unsatisfactory image processing effect in traditional methods is solved, and better image optimization effect is achieved.
Patent Information
- Application Number
- CN202510005138.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-02
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2045-01-02
AI Technical Summary
When traditional image preprocessing methods target different types of cultural and tourism images, the processing effect is not ideal, and even side effects such as contrast distortion occur.
By acquiring the target cultural and tourism images, adding target noise and performing image segmentation and model training, using the preset model to output noise information, image optimization is performed based on the noise information, and processing strategies are dynamically adjusted.
It improves the adaptability and robustness of image processing, ensures the optimization and processing effect of different types of cultural and tourism images, avoids contrast distortion, and improves image quality.
Smart Images

Figure CN120070279A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing, and in particular, to an image preprocessing method for generating interactive cultural and tourism content. Background Art
[0002] The cultural and tourism industry is an important part of the tourism industry. The economic pillars of many places come from the cultural and tourism industry. If the cultural and tourism industry wants to be strong, it not only needs special geographical scenery, landscapes, and cultures, but also needs to combine modern technological means.
[0003] In the generation of interactive cultural and tourism content, image preprocessing technology has a wide range of applications. For example, in virtual tourism scenarios, the visual effect and realism of virtual scenes can be improved through image preprocessing technology; in the digital display of cultural heritage, the original appearance and detailed features of cultural heritage can be restored through image preprocessing technology; in the beautification of tourist photos, noise and defects in photos can be removed through image preprocessing technology, improving the overall aesthetic feeling of the photos.
[0004] The traditional image resource preprocessing method is relatively single. Usually, image pixels are processed based on experience and mathematical models to improve image quality. At the same time, the traditional processing process depends on fixed algorithms and rules and cannot fully consider the specific situation of the image. Therefore, when optimizing different types of cultural and tourism images, the image processing effect is not ideal, and even side effects such as contrast distortion may occur.
[0005] Therefore, there is an urgent need for an image preprocessing method for generating interactive cultural and tourism content. Summary of the Invention
[0006] The present application provides an image preprocessing method and device for generating interactive cultural and tourism content, which solves the problem that when optimizing different types of cultural and tourism images according to their quality, the image processing effect is not ideal, and even side effects such as contrast distortion may occur.
[0007] In the first aspect of the present application, an image preprocessing method for generating interactive cultural and tourism content is provided. The method includes:
[0008] Obtain a target cultural and tourism image, and obtain a preprocessed image corresponding to the target cultural and tourism image through preprocessing;
[0009] Add target noise to the preprocessed image to obtain a sample image corresponding to the target cultural and tourism image;
[0010] Input the sample image into a first preset model for image segmentation, and output a segmented image through the first preset model;
[0011] Train the second preset model based on the segmented image, and obtain the trained image evaluation model through the second preset model;
[0012] Input the target cultural and tourism image into the image evaluation model, and output the noise information corresponding to the target cultural and tourism image through the image evaluation model;
[0013] Based on the noise information, optimize the target cultural and tourism image, and output the target optimized image corresponding to the target cultural and tourism image.
[0014] Optionally, the obtaining of the preprocessed image corresponding to the target cultural and tourism image through preprocessing specifically includes:
[0015] Scale the target cultural and tourism image in a manner with a fixed length-width ratio to obtain a scaled image corresponding to the target cultural and tourism image;
[0016] Perform normalization processing on the scaled image to obtain the preprocessed image.
[0017] Optionally, the preprocessed image includes a first preprocessed image, a second preprocessed image, and a third preprocessed image, the sample image includes the first sample image, the second sample image, and the third sample image, and the target noise includes a first target noise, a second target noise, and a third target noise; the adding of the target noise to the preprocessed image to obtain the sample image corresponding to the target cultural and tourism image specifically includes:
[0018] Add the first target noise to the first preprocessed image to obtain the first sample image;
[0019] Add the second target noise to the second preprocessed image to obtain the second sample image;
[0020] Add the third target noise to the third preprocessed image to obtain the third sample image;
[0021] Wherein, the types of the target noise include Gaussian noise, Rayleigh noise, salt-and-pepper noise, Poisson noise, and impulse noise, and the types of the first target noise, the second target noise, and the third target noise are all different.
[0022] Optionally, the first preset model includes a conversion layer, a segmentation module, and a noise detection module; the inputting of the sample image into the first preset model for image segmentation and the outputting of the segmented image through the first preset model specifically includes:
[0023] The first sample image, the second sample image, and the third sample image are respectively subjected to conversion mapping through the conversion layer to obtain a first converted sample image corresponding to the first sample image, a second converted sample image corresponding to the second sample image, and a third converted sample image corresponding to the third sample image;
[0024] The first converted sample image and the second converted sample image are input into the segmentation module for segmentation to obtain a first pre-segmented image;
[0025] The first converted sample image and the third converted sample image are input into the segmentation module for segmentation to obtain a second pre-segmented image;
[0026] The second converted sample image and the third converted sample image are input into the segmentation module for segmentation to obtain a third pre-segmented image;
[0027] The first pre-segmented image, the second pre-segmented image, and the third pre-segmented image are respectively input into the noise detection module for noise detection, and the noise detection is used to calculate the existence probability of the corresponding target noise in the pre-segmented image;
[0028] If the sum of the existence probabilities of the first target noise and the second target noise in the first pre-segmented image is less than the segmentation noise threshold, the segmentation parameters in the segmentation module are adjusted for re-segmentation until the existence probability of the corresponding target noise is greater than or equal to the segmentation noise threshold, and then the segmented first pre-segmented image is used as the first segmented image;
[0029] If the sum of the existence probabilities of the first target noise and the third target noise in the second pre-segmented image is less than the segmentation noise threshold, the segmentation parameters in the segmentation module are adjusted for re-segmentation until the existence probability of the corresponding target noise is greater than or equal to the segmentation noise threshold, and then the segmented second pre-segmented image is used as the second segmented image;
[0030] If the sum of the existence probabilities of the second target noise and the third target noise in the third pre-segmented image is less than the segmentation noise threshold, the segmentation parameters in the segmentation module are adjusted for re-segmentation until the existence probability of the corresponding target noise is greater than or equal to the segmentation noise threshold, and then the segmented third pre-segmented image is used as the third segmented image;
[0031] Among them, the segmentation noise threshold is 0.7 - 0.8.
[0032] Optionally, the second preset model includes a feature extraction module, a noise recognition module, and a noise analysis module. The model training of the second preset model is performed according to the segmented image, and the trained image evaluation model is obtained through the second preset model, specifically including:
[0033] The feature extraction module extracts features from the first pre-segmented image, the second pre-segmented image, and the third pre-segmented image respectively, and obtains the first feature in the first pre-segmented image, the second feature in the second pre-segmented image, and the third feature in the third pre-segmented image;
[0034] According to the first feature, obtain the first loss function corresponding to the first pre-segmented image, according to the second feature, obtain the second loss function corresponding to the second pre-segmented image, and according to the third feature, obtain the third loss function corresponding to the third pre-segmented image;
[0035] Perform weighted summation on the first loss function, the second loss function, and the third loss function to obtain a multi-scale loss function, where the weight ratio of the first loss function, the second loss function, and the third loss function is 3:2:1;
[0036] Train the noise recognition module and the noise analysis module based on the multi-scale loss function to obtain the trained image evaluation model.
[0037] Optionally, the noise information includes the noise type and the signal-to-noise ratio. The output of the noise information corresponding to the target cultural and tourism image by the image evaluation model specifically includes:
[0038] Analyze the signal-to-noise ratio value of the target cultural and tourism image through the image evaluation model;
[0039] Identify the noise type of the target cultural and tourism image through the image evaluation model.
[0040] Optionally, the image optimization of the target cultural and tourism image based on the noise information specifically includes:
[0041] Judge whether the signal-to-noise ratio value of the target cultural and tourism image is greater than or equal to a first preset signal-to-noise ratio value;
[0042] If the corresponding signal-to-noise ratio value is greater than or equal to the first preset signal-to-noise ratio value, directly output the target cultural and tourism image;
[0043] Wherein, the first preset signal-to-noise ratio value is 62 - 68 db.
[0044] Optionally, after judging whether the signal-to-noise ratio value is greater than or equal to the first preset signal-to-noise ratio value, the method further includes:
[0045] If the signal-to-noise ratio value of the target cultural and tourism image is less than the first preset signal-to-noise ratio value, judge whether the corresponding signal-to-noise ratio value is greater than or equal to a second preset signal-to-noise ratio value;
[0046] If the corresponding signal-to-noise ratio is greater than or equal to the second preset signal-to-noise ratio, obtain the noise type in the target cultural and tourism image;
[0047] Confirm the denoising algorithm corresponding to the target cultural and tourism image according to the noise type, and the denoising algorithm includes mean filtering algorithm, median filtering algorithm, Gaussian filtering algorithm and bilateral filtering algorithm;
[0048] Perform denoising processing on the target cultural and tourism image through the denoising algorithm;
[0049] Wherein, the second preset signal-to-noise ratio is less than the first preset signal-to-noise ratio, and the second preset signal-to-noise ratio is 38 - 42 db.
[0050] Optionally, after determining whether the corresponding signal-to-noise ratio is greater than or equal to the second preset signal-to-noise ratio when the signal-to-noise ratio is less than the first preset signal-to-noise ratio, the method further includes:
[0051] If the corresponding signal-to-noise ratio is less than the second preset signal-to-noise ratio, determine whether the corresponding signal-to-noise ratio is greater than or equal to the third preset signal-to-noise ratio;
[0052] If the corresponding signal-to-noise ratio is greater than or equal to the third preset signal-to-noise ratio, perform image enhancement on the target cultural and tourism image, and the image enhancement methods include histogram equalization, contrast stretching, gray-scale transformation and Fourier transform;
[0053] Obtain the noise type in the target cultural and tourism image, and confirm the denoising algorithm corresponding to the target cultural and tourism image according to the noise type;
[0054] Perform denoising processing on the target cultural and tourism image after image enhancement through the denoising algorithm;
[0055] Wherein, the third preset signal-to-noise ratio is less than the second preset signal-to-noise ratio, and the third preset signal-to-noise ratio is 22 - 28 db.
[0056] Optionally, after determining whether the corresponding signal-to-noise ratio is greater than or equal to the third preset signal-to-noise ratio when the corresponding signal-to-noise ratio is less than the second preset signal-to-noise ratio, the method further includes:
[0057] If the corresponding signal-to-noise ratio is less than the third preset signal-to-noise ratio, remove the corresponding target cultural and tourism image.
[0058] In the second aspect of the present application, an image preprocessing device for generating interactive cultural and tourism content is provided. The device includes an acquisition module, a model construction module and a processing module. Among them,
[0059] An acquisition module, configured to acquire a target cultural and tourism image, and obtain a preprocessed image corresponding to the target cultural and tourism image through preprocessing.
[0060] A model construction module, configured to add target noise to the preprocessed image to obtain a sample image corresponding to the target cultural and tourism image; input the sample image into a first preset model for image segmentation, and output a segmented image through the first preset model; perform model training on a second preset model according to the segmented image, and obtain a trained image evaluation model through the second preset model.
[0061] A processing module, configured to input the target cultural and tourism image into the image evaluation model, and output noise information corresponding to the target cultural and tourism image through the image evaluation model; based on the noise information, perform image optimization on the target cultural and tourism image, and output a target optimized image corresponding to the target cultural and tourism image.
[0062] In a third aspect of the present application, an electronic device is provided, including a processor, a memory, a user interface, and a network interface. The memory is used to store instructions, the user interface and the network interface are used to communicate with other devices, and the processor is used to execute the instructions stored in the memory, so that the electronic device executes the method as described in any one of the above.
[0063] In a fourth aspect of the present application, a computer-readable storage medium is provided. The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to perform the method as described in any one of the above.
[0064] One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages:
[0065] 1. Acquire a target cultural and tourism image and obtain a preprocessed image corresponding to the target cultural and tourism image through preprocessing operations, add target noise to the preprocessed image to obtain a sample image corresponding to the target cultural and tourism image, input the sample image into a first preset model for image segmentation, and output a segmented image through the first preset model, so as to perform model training on a second preset model according to the segmented image, and obtain a trained image evaluation model through the second preset model, input the target cultural and tourism image into the image evaluation model, and output noise information corresponding to the target cultural and tourism image through the image evaluation model, based on the noise information, perform image optimization on the target cultural and tourism image, and output a target optimized image corresponding to the target cultural and tourism image. Furthermore, by combining the content and quality characteristics of the target cultural and tourism image through an adaptive optimization algorithm, the image processing strategy is dynamically adjusted, solving the problem that when performing optimization processing corresponding to the quality of different types of cultural and tourism images, the image processing effect is not ideal, and even side effects such as contrast distortion occur.
[0066] 2. The target cultural and tourism image is scaled in a way that keeps the aspect ratio fixed to obtain a scaled image corresponding to the target cultural and tourism image, and the scaled image is normalized to obtain a preprocessed image, thus ensuring the consistency of the target cultural and tourism image in different sizes and reducing the impact of differences in brightness and contrast between different images on subsequent processing through a standardized pixel value range, providing a more stable input for image segmentation and optimization.
[0067] 3. By adding different types of noise to the target cultural and tourism image, various interferences that the target cultural and tourism image may encounter in the real world can be simulated, which helps the training model learn to identify useful information from the noise, thereby improving the model's robustness to noise. Description of the Drawings
[0068] Figure 1 is a schematic flowchart of an image preprocessing method for generating interactive cultural and tourism content provided by an embodiment of the present application;
[0069] Figure 2 is a structural block diagram of a first preset model provided by an embodiment of the present application;
[0070] Figure 3 is a structural block diagram of a second preset model provided by an embodiment of the present application;
[0071] Figure 4 is a module schematic diagram of an image preprocessing device for generating interactive cultural and tourism content provided by an embodiment of the present application;
[0072] Figure 5 is a structural schematic diagram of an electronic device provided by an embodiment of the present application.
[0073] Description of the Reference Numerals: 21, conversion layer; 22, segmentation module; 23, noise detection module; 31, feature extraction module; 32, noise recognition module; 33, noise analysis module; 41, acquisition module; 42, model construction module; 43, processing module; 501, processor; 502, communication bus; 503, user interface; 504, network interface; 505, memory. Detailed Embodiments
[0074] In order to enable those skilled in the art to better understand the technical solutions in this specification, the following will clearly and completely describe the technical solutions in the embodiments of this specification with reference to the accompanying drawings in the embodiments of this specification. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments.
[0075] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments and are not intended to limit the present application. As used in the specification of the present application, the singular forms "a", "an", "the", "above-mentioned", "said", and "this" are also intended to include the plural forms, unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used in the present application refers to and includes any or all possible combinations of one or more of the listed items.
[0076] Hereinafter, the terms "first" and "second" are only used for descriptive purposes and should not be construed as implying or suggesting relative importance or implicitly indicating the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of such features. In the description of the embodiments of the present application, unless otherwise specified, the meaning of "a plurality" is two or more.
[0077] In order to enable those skilled in the art to better understand the technical solutions of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings.
[0078] Please refer to Figure 1 , which shows a schematic flowchart of an image preprocessing method for generating interactive cultural and tourism content provided by an embodiment of the present application. The flowchart mainly includes the following steps: S101 to S106.
[0079] Step S101, obtain a target cultural and tourism image, and obtain a preprocessed image corresponding to the target cultural and tourism image through preprocessing.
[0080] Specifically, the camera used for collection can be a high-quality camera, including but not limited to single-lens reflex cameras, mirrorless cameras, or high-end smartphones, etc. The entire shooting process needs to ensure clear images and accurate colors. The shooting lens can be appropriately selected according to the shooting theme. For example, for natural scenery, a wide-angle lens can be used; for characteristic cultural images, a telephoto lens can be used. The collected target cultural and tourism images are saved through a sufficient memory card or external storage device.
[0081] Furthermore, the target cultural and tourism image is scaled in a manner that fixes the aspect ratio of the length and width to obtain a scaled image corresponding to the target cultural and tourism image; the scaled image is normalized to obtain a preprocessed image. Assuming that the target cultural and tourism image is represented by x, please refer to steps S111 to S112:
[0082] Step S111: Scale the target cultural and tourism image x in a way that keeps the aspect ratio fixed, so that the longest side is scaled to 256px to obtain a scaled image. First, the original dimensions of the target cultural and tourism image x, including width and height, need to be detected to determine whether the longest side is the width or the height. Then, the scaling ratio is calculated based on the longest side. Finally, the calculated scaling ratio is used to adjust the width and height of the image while keeping the aspect ratio unchanged. If the longest side is the width, the new width is 256px and the new height is the result of multiplying the original height by the scaling ratio. If the longest side is the height, the new height is 256px and the new width is the result of multiplying the original width by the scaling ratio. Scaling the width and height of the image according to the original aspect ratio can maintain the original shape and ratio of the image and minimize distortion to the greatest extent. Scaling the image helps reduce the storage space and loading time of the image file and facilitates subsequent image processing.
[0083] Step S112: Normalize the scaled image to obtain a normalized image. Select a suitable normalization method according to actual needs. For example, min-max normalization and Z-score standardization. Among them, the min-max normalization method is preferably used. Calculate the minimum and maximum values of the image pixel values and use these parameters in the normalization formula. The pixel values of the normalized image are restricted within the range of [0,1], which helps eliminate the pixel value differences between different images and makes them easier to compare and analyze. For each pixel value X in the scaled image, its normalized pixel value X′ can be calculated by the following formula:
[0084]
[0085] where min(X image ) is the minimum value of all pixel values in the entire image, and max(X image ) is the maximum value of all pixel values in the entire image.
[0086] Step S102: Add target noise to the preprocessed image to obtain a sample image corresponding to the target cultural and tourism image.
[0087] Specifically, the preprocessed image G(x) is divided into three independent groups of images, namely the first preprocessed image G(x1), the second preprocessed image G(x2), and the third preprocessed image G(x3). The first target noise z1 is added to the first preprocessed image G(x1) to obtain the first sample image G(x1, z1); the second target noise z2 is added to the second preprocessed image G(x2) to obtain the second sample image G(x2, z2); the third target noise is added to the third preprocessed image G(x3) to obtain the third sample image G(x3, z3); and the first sample image G(x1, z1), the second sample image G(x2, z2), and the third sample image G(x3, z3) are used as the sample image G(x, z). It should be noted that in the embodiments provided in this application, the first target noise, the second target noise, and the third target noise are the target noise, and the target noise z includes, but is not limited to: Gaussian noise, Rayleigh noise, salt-and-pepper noise, Poisson noise, impulse noise; determine the parameters of different noises, use a random number generator to simulate the distribution of the noise, and superimpose the generated noise image on the corresponding first preprocessed image G(x1), second preprocessed image G(x2), and third preprocessed image G(x3) through pixel value addition to obtain the first sample image G(x1, z1), the second sample image G(x2, z2), and the third sample image G(x3, z3). By adding the target noise z to the preprocessed image G(x), the diversity of image data can be increased, thereby improving the generalization ability of the model.
[0088] Step S103: Input the sample image into the first preset model for image segmentation, and output the segmented image through the first preset model.
[0089] Specifically, please refer to Figure 2, which shows the structural block diagram of the first preset model provided by the embodiment of the present application. Among them, the first preset model includes a conversion layer 21, a segmentation module 22, and a noise detection module 23. The conversion layer 21 performs conversion mapping on the first sample image, the second sample image, and the third sample image respectively to obtain the first converted sample image corresponding to the first sample image, the second converted sample image corresponding to the second sample image, and the third converted sample image corresponding to the third sample image; the first converted sample image and the second converted sample image are input into the segmentation module 22 for segmentation to obtain the corresponding first pre-segmented image; the first converted sample image and the third converted sample image are input into the segmentation module 22 for segmentation to obtain the corresponding second pre-segmented image; the second converted sample image and the third converted sample image are input into the segmentation module 22 for segmentation to obtain the corresponding third pre-segmented image; the first pre-segmented image, the second pre-segmented image, and the third pre-segmented image are respectively input into the noise detection module 23 for noise detection, and the noise detection is used to calculate the existence probability of the corresponding target noise in the pre-segmented image; if it is confirmed that the sum of the existence probability of the first target noise and the first target noise in the first pre-segmented image is greater than or equal to 0.75, the first pre-segmented image is directly used as the first segmented image. If it is confirmed that the existence probability is less than 0.75, the segmentation parameters in the noise detection module 23 are adjusted and re-segmented until the existence probability of the corresponding target noise is greater than or equal to 0.75; the confirmation of the second segmented image and the third segmented image is the same as the processing method of the first segmented image. The whole process can prevent the corresponding converted sample image from being segmented too small and avoid damage to the added target noise. Please refer to steps S131 to S133.
[0090] Step S131, the conversion layer 21 processes the first sample image G(x1, z1), the second sample image G(x2, z2), and the third sample image G(x3, z3) to obtain the first converted sample image, the second converted sample image, and the third converted sample image: In this embodiment, the functions and characteristics of the conversion layer 21 are defined according to actual needs. The conversion layer 21 can be a neural network layer, an image processing algorithm, or any other module that can transform images. The present invention does not limit this here. For each sample image. Taking G(x i , z i ) as an example, the sample image can be transformed through the following formula:
[0091] T(G(x i , z i )) = σ(W * G(x i , z i ) + b);
[0092] Among them, T represents transforming the sample image, G(x i , zi ) is the sample image of the i-th input, b is the bias term, and σ is the activation function used to introduce non-linearity. Common activation functions include ReLU, sigmoid, tanh, etc. The first sample image G(x1,z1), the second sample image G(x2,z2), and the third sample image G(x3,z3) are respectively input into the transformation layer 21 for specified transformation or mapping; the transformation layer 21 can perform contrast enhancement, color correction, and image restoration on the input image. Among them, histogram equalization, contrast stretching, etc. can be used for contrast enhancement to enhance the contrast of the image; color space conversion, color balance, etc. can be used for color correction to correct the color of the image; image restoration algorithms can be used to repair the defective or damaged parts in the image.
[0093] Step S132: Input the first transformed sample image and the second transformed sample image into the segmentation module 22 for segmentation to obtain the first pre-segmented image; input the first transformed sample image and the third transformed sample image into the segmentation module 22 for segmentation to obtain the second pre-segmented image; input the second transformed sample image and the third transformed sample image into the segmentation module 22 for segmentation to obtain the third pre-segmented image: Select a suitable image segmentation algorithm or model as the segmentation module 22 according to actual needs. Image segmentation algorithms include threshold-based segmentation, edge-based segmentation, region-based segmentation, and deep learning-based segmentation, which are not limited in the present invention. Input the first transformed sample image and the second transformed sample image into the segmentation module 22 for image segmentation processing. The segmentation module 22 divides the image according to a preset algorithm or model and outputs the first pre-segmented image; input the first transformed sample image and the third transformed sample image into the segmentation module 22 at the same time. The segmentation module 22 segments each of the first transformed sample image and the third transformed sample image and outputs the second pre-segmented image; input the second transformed sample image and the third transformed sample image into the segmentation module 22 at the same time. The segmentation module 22 segments each of the second transformed sample image and the third transformed sample image and outputs the third pre-segmented image; the segmented images can present different characteristics and styles and can be used as input data for subsequent image processing or machine learning tasks.
[0094] Step S133, select a suitable noise detection algorithm or model as the noise detection module 23; sequentially input the first pre-segmented image, the second pre-segmented image, and the third pre-segmented image into the noise detection module 23 for detection. The noise detection module 23 analyzes each image and outputs a value representing the noise probability. If the probability of the corresponding target noise detected is less than 0.75, adjust the corresponding segmentation parameters f1, f2, f3 of the segmentation module and re-segment the corresponding image; if the probability of the detected noise is not less than 0.75, output the corresponding first segmented image F(G(x1, z1)), second segmented image F(G(x2, z2)), and third segmented image F(G(x3, z3)). For each pre-segmented image, if the noise probability output by the noise detection module 23 is less than 0.75, it is considered that the image segmentation does not meet the requirements. In this case, it is necessary to adjust the corresponding segmentation parameters f1, f2, f3 (corresponding to the segmentation parameters of the first, second, and third pre-segmented images respectively), and these parameters include segmentation thresholds, weights in the segmentation algorithm, and the number of iterations; after adjusting the parameters, re-segment the corresponding pre-segmented image to obtain a new pre-segmented image, and perform noise detection again; if the noise probability output by the noise detection module 23 is not less than 0.75, directly output the corresponding first segmented image F(G(x1, z1)), second segmented image F(G(x2, z2)), and third segmented image F(G(x3, z3)), and these segmented images are the final output results and can be used for subsequent image processing or analysis tasks. This processing process enhances the adaptability and robustness of the segmentation module to different types of input images by iteratively adjusting the segmentation parameters and re-segmenting, which enables the segmentation module to better process images with different characteristics and styles; at the same time, it can also provide better input data for subsequent image processing or analysis tasks.
[0095] Step S104, perform model training on the second preset model according to the segmented images, and obtain the trained image evaluation model through the second preset model.
[0096] Specifically, please refer to Figure 3, which shows the structural block diagram of the second preset model provided by the embodiment of the present application. The second preset model includes a feature extraction module 31, a noise recognition module 32, and a noise analysis module 33. The feature extraction module 31 performs feature extraction operations on the first pre-segmented image, the second pre-segmented image, and the third pre-segmented image respectively, and obtains the first feature in the first pre-segmented image, the second feature in the second pre-segmented image, and the third feature in the third pre-segmented image; obtains the first loss function corresponding to the first pre-segmented image according to the first feature, obtains the second loss function corresponding to the second pre-segmented image according to the second feature, and obtains the third loss function corresponding to the third pre-segmented image according to the third feature; performs weighted summation on the first loss function, the second loss function, and the third loss function to obtain a multi-scale loss function, where the weight ratio of the first loss function, the second loss function, and the third loss function is 3:2:1; trains the noise recognition module 32 and the noise analysis module 33 based on the multi-scale loss function to obtain a trained image evaluation model. Please refer to steps S141 to S144.
[0097] Step S141: Input the first segmented image F(G(x1, z1)), the second segmented image F(G(x2, z2)), and the third segmented image F(G(x3, z3)) into the feature extraction module 31 in sequence for feature extraction to obtain the first feature, the second feature, and the third feature: Select a suitable feature extraction algorithm or model as the feature extraction module 31. The feature extraction algorithms include local feature description algorithms (such as SIFT, SURF, HOG) and deep learning-based methods, which are not limited in the present invention. This module can analyze the input segmented images and extract representative, discriminative, and stable features; input the first segmented image F(G(x1, z1)), the second segmented image F(G(x2, z2)), and the third segmented image F(G(x3, z3)) into the feature extraction module 31 in sequence for processing; the feature extraction module 31 analyzes each segmented image and extracts the features in the image according to the characteristics of the selected algorithm or model. These features include the color features, texture features, shape features, gradient features, and optical flow features of the image; after the feature extraction module 31 finishes processing, it outputs the first feature, the second feature, and the third feature. These features can quantitatively describe the input segmented images and can be used for subsequent image processing, classification, recognition, or matching tasks.
[0098] Step S142: Input the first segmented image F(G(x1, z1)), the second segmented image F(G(x2, z2)), and the third segmented image F(G(x3, z3)) into the feature extraction module 31 in sequence to extract features, obtaining the first feature, the second feature, and the third feature. According to the specific requirements and characteristics of the image, select an appropriate type of loss function. The loss functions include cross-entropy loss, Dice loss, and IOU loss, which are not limited in the present invention. Define corresponding loss functions for the first segmented image, the second segmented image, and the third segmented image according to formulas or definitions. Input the prediction results and actual results of the segmented images into the corresponding loss functions to calculate the loss values. According to the calculated loss values, optimize the model parameters through multiple iterations of the backpropagation algorithm until the loss value reaches a predetermined threshold or no longer decreases significantly. By calculating the loss values and optimizing the model parameters, the model can have stronger adaptability and robustness to different types of input images.
[0099] Step S143: Perform weighted summation on the first loss function, the second loss function, and the third loss function to obtain a multi-scale loss function, where the weight ratio of the first loss function, the second loss function, and the third loss function is 3:2:1.
[0100] Step S144: Train the noise recognition module 32 and the noise analysis module 33 based on the multi-scale loss function. In this embodiment, by using the set weight ratio, perform weighted summation on the first loss function, the second loss function, and the third loss function to obtain a multi-scale loss function. The specific formula is: L total = 3×L Ⅰ + 2×L Ⅱ + 1×L Ⅲ , where L Ⅰ , L Ⅱ , and L Ⅲ represent the values of the first loss function, the second loss function, and the third loss function respectively. Use the multi-scale loss function as the objective function for model optimization, and update and iterate the model parameters through multiple times of the backpropagation algorithm to minimize the total loss. The multi-scale loss function can reduce the model's dependence on single-scale information, enabling the model to have stronger adaptability and robustness when facing input images of different scales. At the same time, this weight allocation can balance the contributions of different loss functions to model optimization, helping the model converge to the optimal solution faster.
[0101] In addition, the design of the multi-scale loss function enables the model to learn information at different scales, thereby improving the generalization ability of the model. As a result, when faced with unseen noise types or signal environments, the model can still exhibit good performance. By training the noise recognition module 32, the noise type and location in the input data can be more accurately identified, which helps to remove noise in subsequent image analysis and improve the quality of the data. By training the noise analysis module 33, the characteristics and sources of the noise can be deeply analyzed, providing strong support for noise elimination or suppression. This helps to extract useful information in complex signal environments and improve the accuracy and efficiency of signal processing.
[0102] Step S105: Input the target cultural and tourism image into the image evaluation model, and output the noise information corresponding to the target cultural and tourism image through the image evaluation model.
[0103] Specifically, the trained noise recognition module 32 and noise analysis module 33 are used to obtain the cultural and tourism images respectively. The noise recognition module 32 is a machine learning-based classifier, including support vector machine (SVM), random forest, and neural network. The classifier can output the noise type s1 in the cultural and tourism image x according to the input features and the trained model. In noise analysis, appropriate filters and parameters are selected to separate the noise signal from the cultural and tourism image x. According to the separated noise signal and the original image signal, the signal-to-noise ratio s2 is calculated. Among them, the signal-to-noise ratio s2 can be calculated by comparing the mean square error (MSE) of the original image and the noise image, or the peak signal-to-noise ratio (PSNR) can be used as the evaluation criterion. By identifying the noise type s1 and calculating the signal-to-noise ratio s2, subsequent image denoising, enhancement and other processing operations can be guided, which helps to improve the quality of the cultural and tourism image, making it clearer and more realistic, and helps to improve the user experience and visual effect. For the trained regeneration recognition module: A machine learning-based classifier is used as the core, and the classifier supports multiple algorithms, such as support vector machine (SM), random forest, and neural network. In practical applications, according to the image features and the scale of the dataset, the most suitable classification algorithm is selected for training to ensure that the noise type in the image can be accurately identified; for the noise analysis module 33: The noise analysis module 33 selects appropriate filters and parameters to accurately separate the noise signal from the image. After separating the noise signal, the noise analysis module 33 will use the original image signal and the noise signal for comparative analysis and calculate the signal-to-noise ratio s2. This index can be obtained by comparing the mean square error (MSE) of the original image and the noise image, or the peak signal-to-noise ratio (PSNR) can be selected as the evaluation criterion. The specific formula is as follows, the mean square error formula:
[0104]
[0105] Among them, MSE is the mean square error, I(i,j) represents the original image, that is, the pixel value in the target cultural and tourism image, K(i,j) represents the pixel value in the noisy image, and m and n respectively represent the number of rows and columns in the image. Peak signal-to-noise ratio formula:
[0106]
[0107] Among them, MAX I represents the possible maximum pixel value in the image, MSE is the mean square error, and PSNR is the peak signal-to-noise ratio. For different types of noise (such as Gaussian noise, salt-and-pepper noise, etc.), corresponding denoising algorithms will be selected for processing. The denoising algorithms include but are not limited to: mean filtering algorithm, median filtering algorithm, Gaussian filtering algorithm, and bilateral filtering algorithm, and a suitable denoising algorithm can be selected according to the actual processing situation. For example, for Gaussian noise, a Gaussian filter can be considered for smoothing processing; while for salt-and-pepper noise, a median filter is more suitable for denoising. According to the calculated signal-to-noise ratio s2, the noise level of the image can be evaluated, and based on this, it can be determined whether further denoising or enhancement processing is required. For example, when the signal-to-noise ratio is low, a more powerful denoising algorithm can be adopted or multiple iterations can be performed to improve the image quality. At the same time, the signal-to-noise ratio s2 can also be used as an optimization objective, and by adjusting the parameters of the denoising algorithm or selecting different algorithm combinations, the best image denoising and enhancement effects can be sought.
[0108] Step S106, based on the noise information, optimize the target cultural and tourism image, and output the target optimized image corresponding to the target cultural and tourism image.
[0109] Specifically, calculate the target cultural and tourism image corresponding to the noise information through the image evaluation model. The noise information includes the signal-to-noise ratio value and the noise type. Determine whether the signal-to-noise ratio value is greater than or equal to 65 db. If the signal-to-noise ratio value is greater than or equal to 65 db, directly output the target cultural and tourism image as the target optimized image. If the signal-to-noise ratio value is less than 65 db, determine whether the signal-to-noise ratio value is greater than or equal to 40 db; if the signal-to-noise ratio value is greater than or equal to 40 db, obtain the noise type information in the target cultural and tourism image, and obtain the corresponding denoising algorithm according to the noise type information; perform denoising processing on the target cultural and tourism image through the denoising algorithm, and output the target optimized image corresponding to the target cultural and tourism image. If the signal-to-noise ratio value is less than 40 db, determine whether the signal-to-noise ratio value is greater than or equal to 25 db; if the signal-to-noise ratio value is greater than or equal to 25 db, perform image enhancement on the target cultural and tourism image according to the signal-to-noise ratio value, and perform denoising processing on the target cultural and tourism image through the corresponding denoising algorithm; output the target optimized image corresponding to the target cultural and tourism image. Please refer to steps S161 to S164.
[0110] Step S161, when the signal-to-noise ratio s2 of the cultural and tourism image x ≥ 65 db, directly output the corresponding image, that is, directly output the target cultural and tourism image as the target optimized image.
[0111] Step S162, when the signal-to-noise ratio s2 of the cultural and tourism image x < 65 db, then determine whether the signal-to-noise ratio s2 ≥ 45 db; if so, determine the denoising algorithm according to the noise type s1, and process the cultural and tourism image x through the denoising algorithm to obtain the optimized image, otherwise go to the next step;
[0112] Step S163, when the signal-to-noise ratio s2 of the cultural and tourism image x < 45 db, then determine whether the signal-to-noise ratio s2 ≥ 25 db; if so, first perform image enhancement on the cultural and tourism image x according to the signal-to-noise ratio s2, then determine the denoising algorithm according to the noise type s1, and then process the cultural and tourism image x through the denoising algorithm to obtain the optimized image, otherwise go to the next step;
[0113] Step S164, when the signal-to-noise ratio s2 of the cultural and tourism image x < 25 db, then reject the target cultural and tourism image.
[0114] Among them, the denoising algorithms include mean filtering, median filtering, Gaussian filtering, and bilateral filtering. The ways to perform image enhancement on the cultural and tourism image x include: histogram equalization, contrast stretching, gray-scale transformation, and Fourier transform. When the signal-to-noise ratio s2 of the cultural and tourism image x reaches or exceeds 65 dB, the image quality is usually very high and the noise level is extremely low. Therefore, it can be directly output without any processing, which ensures the rapid transmission and use of high-quality images and avoids unnecessary processing time and resource consumption. When the signal-to-noise ratio s2 of the cultural and tourism image x is between 45 dB and 65 dB, although the image quality is still relatively high, there may be a certain degree of noise. At this time, selecting a suitable denoising algorithm for processing according to the noise type s1 (such as Gaussian noise, salt-and-pepper noise, etc.) can effectively reduce the noise level while maintaining the details and clarity of the image; this helps to improve the visual quality of the image and the accuracy of subsequent processing. When the signal-to-noise ratio s2 of the cultural and tourism image x is between 25 dB and 45 dB, the image quality has decreased significantly and the noise level is relatively high; at this time, first performing image enhancement processing can improve the brightness and contrast of the image and make the image clearer and more distinguishable; then, selecting a suitable denoising algorithm according to the noise type s1 for processing can further reduce the noise level; this combined processing strategy helps to significantly improve the overall quality of the image while maintaining the image details. When the signal-to-noise ratio s2 of the cultural and tourism image x is lower than 25 dB, the image quality is extremely poor and the noise level is extremely high, and it is almost impossible to obtain useful information from it; at this time, rejecting these images can avoid their interference with subsequent processing or analysis and save processing time and resources at the same time; this is an effective quality control measure to ensure that only qualified images are used for subsequent processing or analysis.
[0115] By adopting the above method, the present application obtains a target cultural and tourism image through a high-quality camera and obtains a preprocessed image corresponding to the target cultural and tourism image through preprocessing operations, adds target noise to the preprocessed image to obtain a sample image corresponding to the target cultural and tourism image, inputs the sample image into a first preset model for image segmentation, and outputs a segmented image through the first preset model. Then, the second preset model is trained according to the segmented image, and a trained image evaluation model is obtained through the second preset model. The target cultural and tourism image is input into the image evaluation model, and the noise information corresponding to the target cultural and tourism image is output through the image evaluation model. Based on the noise information, the target cultural and tourism image is optimized, and a target optimized image corresponding to the target cultural and tourism image is output. Furthermore, an adaptive optimization algorithm is used to dynamically adjust the image processing strategy in combination with the content and quality characteristics of the target cultural and tourism image, solving the problem that when optimizing different types of cultural and tourism images according to their quality, the image processing effect is not ideal, and even side effects such as contrast distortion occur.
[0116] Please refer to Figure 4 , which shows a schematic diagram of modules of an image preprocessing device for generating interactive cultural and tourism content provided by an embodiment of the present application. The device includes an acquisition module 41, a model construction module 42, and a processing module 43, where
[0117] The acquisition module 41 is configured to acquire a target cultural and tourism image and obtain a preprocessed image corresponding to the target cultural and tourism image through preprocessing operations.
[0118] The model construction module 42 adds target noise to the preprocessed image to obtain a sample image corresponding to the target cultural and tourism image; inputs the sample image into a first preset model for image segmentation, and outputs a segmented image through the first preset model; trains the second preset model according to the segmented image, and obtains a trained image evaluation model through the second preset model.
[0119] The processing module 43 is configured to input the target cultural and tourism image into the image evaluation model, and output the noise information corresponding to the target cultural and tourism image through the image evaluation model; optimize the target cultural and tourism image based on the noise information, and output a target optimized image corresponding to the target cultural and tourism image.
[0120] In a possible implementation manner, the acquisition module 41 is configured to obtain a preprocessed image corresponding to the target cultural and tourism image through preprocessing operations, specifically including: scaling the target cultural and tourism image in a manner of fixing the aspect ratio of length to width to obtain a scaled image corresponding to the target cultural and tourism image; performing normalization processing on the scaled image to obtain a preprocessed image.
[0121] In a possible implementation, the preprocessed images include a first preprocessed image, a second preprocessed image, and a third preprocessed image. The model construction module 42 is configured to add target noise to the preprocessed images to obtain sample images corresponding to the target cultural and tourism images, specifically including: adding target noise to the first preprocessed image to obtain a first sample image, where the first target noise is Gaussian noise, the first target noise is Rayleigh noise, and the first target noise is salt-and-pepper noise; adding target noise to the second preprocessed image to obtain a second sample image; adding target noise to the third preprocessed image to obtain a third sample image; and using the first sample image, the second sample image, and the third sample image as the sample images.
[0122] In a possible implementation, the model construction module 42 is configured to input the sample images into a first preset model for image segmentation and output a segmented image through the first preset model, specifically including: performing conversion mapping on the first sample image, the second sample image, and the third sample image respectively through a conversion layer to obtain a first converted sample image corresponding to the first sample image, a second converted sample image corresponding to the second sample image, and a third converted sample image corresponding to the third sample image; inputting the first converted sample image and the first converted sample image into a segmentation module for segmentation to obtain a corresponding first pre-segmented image; inputting the first converted sample image and the third converted sample image into the segmentation module for segmentation to obtain a corresponding second pre-segmented image; inputting the second converted sample image and the third converted sample image into the segmentation module for segmentation to obtain a corresponding third pre-segmented image; inputting the first pre-segmented image, the second pre-segmented image, and the third pre-segmented image into a noise detection module for noise detection, where the noise detection is used to calculate the existence probability of the corresponding target noise in the pre-segmented image; if it is confirmed that the corresponding target noise is less than the segmentation noise threshold, then adjust the segmentation parameters in the noise detection module until the requirements are met, and finally use the qualified first pre-segmented image, second pre-segmented image, and third pre-segmented image as the segmented image output by the first preset model.
[0123] In a possible implementation manner, the model construction module 42 is configured to perform model training on a second preset model according to the segmented image, and obtain a trained image evaluation model through the second preset model, specifically including: performing feature extraction operations on the first pre-segmented image, the second pre-segmented image, and the third pre-segmented image respectively through the feature extraction module, and obtaining the first feature in the first pre-segmented image, the second feature in the second pre-segmented image, and the third feature in the third pre-segmented image; obtaining a first loss function corresponding to the first pre-segmented image according to the first feature, obtaining a second loss function corresponding to the second pre-segmented image according to the second feature, and obtaining a third loss function corresponding to the third pre-segmented image according to the third feature; performing weighted summation on the first loss function, the second loss function, and the third loss function to obtain a multi-scale loss function, where the weight ratio of the first loss function, the second loss function, and the third loss function is 3:2:1; training the noise recognition module and the noise analysis module based on the multi-scale loss function to obtain a trained image evaluation model.
[0124] In a possible implementation manner, the processing module 43 is configured to optimize the target cultural and tourism image based on the noise information and output a target optimized image corresponding to the target cultural and tourism image, specifically including: calculating the noise information of the target cultural and tourism image through the image evaluation model, where the noise information includes the corresponding signal-to-noise ratio value and the noise type; determining whether the signal-to-noise ratio value is greater than or equal to a first preset signal-to-noise ratio value; if the signal-to-noise ratio value is greater than or equal to the preset signal-to-noise ratio value, directly outputting the target cultural and tourism image as the target optimized image.
[0125] In a possible implementation manner, after determining whether the signal-to-noise ratio value is greater than or equal to the first preset signal-to-noise ratio value, if the signal-to-noise ratio value is less than the first preset signal-to-noise ratio value, the processing module 43 is configured to determine whether the signal-to-noise ratio value is greater than or equal to a second preset signal-to-noise ratio value, where the first preset signal-to-noise ratio value is greater than the second preset signal-to-noise ratio value; if the signal-to-noise ratio value is greater than or equal to the second preset signal-to-noise ratio value, obtaining the noise type information in the noise information; obtaining a denoising algorithm corresponding to the target cultural and tourism image according to the noise type information, where the denoising algorithms include a mean filtering algorithm, a median filtering algorithm, a Gaussian filtering algorithm, and a bilateral filtering algorithm; performing denoising processing on the target cultural and tourism image through the denoising algorithm and outputting a target optimized image corresponding to the target cultural and tourism image.
[0126] In a possible implementation manner, if the signal-to-noise ratio value is less than the second preset signal-to-noise ratio value, the processing module 43 is configured to determine whether the signal-to-noise ratio value is greater than or equal to a third preset signal-to-noise ratio value, where the second preset signal-to-noise ratio value is greater than the third preset signal-to-noise ratio value; if the signal-to-noise ratio value is greater than or equal to the third preset signal-to-noise ratio value, first performing image enhancement processing on the target cultural and tourism image, then performing denoising processing on the target cultural and tourism image based on the noise type, and finally outputting a target optimized image corresponding to the target cultural and tourism image.
[0127] In a possible implementation manner, the processing module 43 is configured to directly eliminate the target cultural and tourism image if the signal-to-noise ratio is less than a third preset signal-to-noise ratio.
[0128] It should be noted that when the device provided in the above embodiment realizes its functions, only the division of the above function modules is used for illustration. In actual applications, the above functions can be allocated to different function modules according to needs, that is, the internal structure of the device is divided into different function modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept. For the specific implementation process, please refer to the method embodiment, which will not be elaborated here.
[0129] This application also provides an electronic device. Referring to Figure 5 , Figure 5 FIG. is a schematic structural diagram of an electronic device provided in an embodiment of this application. The electronic device may include: at least one processor 501, at least one communication bus 502, a user interface 503, at least one network interface 504, and a memory 505.
[0130] Among them, the communication bus 502 is used to realize the connection and communication between these components.
[0131] Among them, the user interface 503 may include a display screen (Display) and a camera (Camera). Optionally, the user interface 503 may further include a standard wired interface and a wireless interface.
[0132] Among them, the network interface 504 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).
[0133] Among them, the processor 501 may include one or more processing cores. The processor 501 connects various parts within the entire server through various interfaces and lines, and executes various functions of the server and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 505, and by calling the data stored in the memory 505. Optionally, the processor 501 may be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), or programmable logic array (PLA). The processor 501 may integrate a combination of one or more of a central processing unit (CPU), a graphics processing unit (GPU), and a modem, etc. Among them, the CPU mainly processes the operating system, user interface, application programs, etc.; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 501 and may be implemented separately by a single chip.
[0134] Among them, the memory 505 may include random access memory (RAM) and may also include read-only memory. Optionally, the memory 505 includes a non-transitory computer-readable storage medium. The memory 505 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 505 may include a program storage area and a data storage area. Among them, the program storage area may store instructions for implementing the operating system, instructions for at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-mentioned method embodiments, etc.; the data storage area may store the data involved in the above-mentioned method embodiments. Optionally, the memory 505 may also be at least one storage device located far from the aforementioned processor 501. Refer to Figure 5 , the memory 505, as a computer storage medium, may include an operating system, a network communication module, a user interface module, and an image preprocessing application program for generating interactive cultural and tourism content.
[0135] In Figure 5In the electronic device shown, the user interface 503 is mainly used to provide an input interface for the user and obtain the data input by the user; while the processor 501 can be used to call the image preprocessing application program stored in the memory 505 for generating interactive cultural and tourism content. When executed by one or more processors 501, the electronic device is caused to execute one or more of the methods as described in the above embodiments. It should be noted that for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the present application is not limited by the described action sequence, because according to the present application, certain steps can be adopted in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the present application.
[0136] The present application also provides a computer-readable storage medium, which stores instructions. When executed by one or more processors, the electronic device is caused to execute one or more of the methods as described in the above embodiments.
[0137] In the above embodiments, the descriptions of the various embodiments have their own emphases. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0138] In several implementation manners provided by the present application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection to each other can be through some service interfaces. The indirect coupling or communication connection of the device or unit can be in an electrical or other form.
[0139] The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they can be located in one place, or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0140] In addition, in each embodiment of the present application, the functional units can be integrated in a processing unit, or each unit exists physically alone, or two or more units can be integrated in one unit. The above integrated units can be implemented in the form of hardware or in the form of software functional units.
[0141] When the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods of various embodiments of this application. The aforementioned memory includes: various media such as USB flash drives, mobile hard disks, magnetic disks, or optical discs that can store program codes.
[0142] The foregoing are only exemplary embodiments disclosed in this application and should not be used to limit the scope of the disclosure of this application. That is, any equivalent changes and modifications made in accordance with the teachings of the disclosure of this application still fall within the scope covered by the disclosure of this application. After considering the specification and the disclosure of the practical truth, those skilled in the art will easily think of other implementation schemes of the disclosure of this application.
[0143] This application aims to cover any variations, uses, or adaptive changes of the disclosure of this application, and these variations, uses, or adaptive changes follow the general principles of the disclosure of this application and include common general knowledge or conventional technical means in the technical field not recorded in the disclosure of this application.
Claims
1. An image preprocessing method for interactive cultural tourism content generation, characterized in that: The method comprises: Acquire a target cultural tourism image, and acquire a preprocessed image corresponding to the target cultural tourism image through preprocessing; Adding target noise to the preprocessed image to obtain a sample image corresponding to the target cultural and tourism image; Inputting the sample image into a first preset model for image segmentation, and outputting a segmented image through the first preset model; Performing model training on a second preset model according to the segmented image, and obtaining a trained image evaluation model through the second preset model; Inputting the target cultural tourism image into the image evaluation model, and outputting the noise information corresponding to the target cultural tourism image through the image evaluation model; Based on the noise information, the target cultural and tourism image is optimized, and a target optimized image corresponding to the target cultural and tourism image is output.
2. The method according to claim 1, characterized in that The step of obtaining a preprocessed image corresponding to the target cultural and tourism image through preprocessing specifically includes: Scaling the target cultural tourism image in a manner with a fixed aspect ratio to obtain a scaled image corresponding to the target cultural tourism image; The scaled image is normalized to obtain the preprocessed image.
3. The method according to claim 1, characterized in that The preprocessed image includes a first preprocessed image, a second preprocessed image and a third preprocessed image, the sample image includes a first sample image, a second sample image and a third sample image, and the target noise includes a first target noise, a second target noise and a third target noise; adding target noise to the preprocessed image to obtain a sample image corresponding to the target cultural and tourism image specifically includes: adding a first target noise to the first preprocessed image to obtain the first sample image; adding a second target noise to the second preprocessed image to obtain the second sample image; adding a third target noise to the third preprocessed image to obtain the third sample image; The types of the target noise include Gaussian noise, Rayleigh noise, salt and pepper noise, Poisson noise and impulse noise, and the types of the first target noise, the second target noise and the third target noise are all different.
4. The method according to claim 3, characterized in that: The first preset model includes a conversion layer, a segmentation module and a noise detection module; the inputting the sample image into the first preset model for image segmentation, and outputting the segmented image through the first preset model specifically includes: Performing conversion mapping on the first sample image, the second sample image, and the third sample image respectively through the conversion layer to obtain a first conversion sample image corresponding to the first sample image, a second conversion sample image corresponding to the second sample image, and a third conversion sample image corresponding to the third sample image; Inputting the first transformed sample image and the second transformed sample image into the segmentation module for segmentation to obtain a first pre-segmented image; Inputting the first transformed sample image and the third transformed sample image into the segmentation module for segmentation to obtain a second pre-segmented image; Inputting the second transformed sample image and the third transformed sample image into the segmentation module for segmentation to obtain a third pre-segmented image; Inputting the first pre-segmented image, the second pre-segmented image and the third pre-segmented image into the noise detection module for noise detection, respectively, wherein the noise detection module is used to calculate the existence probability of the corresponding target noise in the pre-segmented image; If the sum of the existence probabilities of the first target noise and the second target noise in the first pre-segmented image is less than the segmentation noise threshold, adjusting the segmentation parameters in the segmentation module and re-segmenting until the corresponding existence probability of the target noise is greater than or equal to the segmentation noise threshold, and then using the segmented first pre-segmented image as the first segmented image; If the sum of the existence probabilities of the first target noise and the third target noise in the second pre-segmented image is less than the segmentation noise threshold, adjusting the segmentation parameters in the segmentation module to re-segment until the existence probability of the corresponding target noise is greater than or equal to the segmentation noise threshold, and then using the segmented second pre-segmented image as the second segmented image; If the sum of the existence probabilities of the second target noise and the third target noise in the third pre-segmented image is less than the segmentation noise threshold, adjusting the segmentation parameters in the segmentation module to re-segment until the existence probability of the corresponding target noise is greater than or equal to the segmentation noise threshold, and the segmented third pre-segmented image is used as the third segmented image; Among them, the segmentation noise threshold is 0.7-0.
8.
5. The method according to claim 4, characterized in that The second preset model includes a feature extraction module, a noise recognition module and a noise analysis module, and the model training of the second preset model according to the segmented image and obtaining the trained image evaluation model through the second preset model specifically includes: Performing feature extraction on the first pre-segmented image, the second pre-segmented image, and the third pre-segmented image respectively by the feature extraction module, and obtaining a first feature in the first pre-segmented image, a second feature in the second pre-segmented image, and a third feature in the third pre-segmented image; Acquire a first loss function corresponding to the first pre-segmented image according to the first feature, acquire a second loss function corresponding to the second pre-segmented image according to the second feature, and acquire a third loss function corresponding to the third pre-segmented image according to the third feature; Performing weighted summation on the first loss function, the second loss function, and the third loss function to obtain a multi-scale loss function, wherein a weight ratio of the first loss function, the second loss function, and the third loss function is 3:2:1; The noise recognition module and the noise analysis module are trained based on the multi-scale loss function to obtain the trained image evaluation model.
6. The method according to claim 1, characterized in that The noise information includes a noise type and a signal-to-noise ratio, and the noise information corresponding to the target cultural and tourism image outputted by the image evaluation model specifically includes: Analyze the signal-to-noise ratio value of the target cultural tourism image through an image evaluation model; The noise type of the target cultural and tourism image is identified through an image evaluation model.
7. The method according to claim 6, characterized in that The performing image optimization on the target cultural and tourism image based on the noise information specifically includes: Determine whether the signal-to-noise ratio value of the target cultural tourism image is greater than or equal to a first preset signal-to-noise ratio value; If the corresponding signal-to-noise ratio value is greater than or equal to the first preset signal-to-noise ratio value, directly output the target cultural tourism image; Among them, the first preset signal-to-noise ratio value is 62-68db.
8. The method according to claim 7, characterized in that After determining whether the signal-to-noise ratio value is greater than or equal to a first preset signal-to-noise ratio value, the method further includes: If the signal-to-noise ratio value of the target cultural tourism image is less than the first preset signal-to-noise ratio value, determining whether the corresponding signal-to-noise ratio value is greater than or equal to a second preset signal-to-noise ratio value; If the corresponding signal-to-noise ratio value is greater than or equal to the second preset signal-to-noise ratio value, then obtaining the noise type in the target cultural tourism image; Determine a denoising algorithm corresponding to the target cultural and tourism image according to the noise type, wherein the denoising algorithm includes a mean filter algorithm, a median filter algorithm, a Gaussian filter algorithm, and a bilateral filter algorithm; Performing denoising processing on the target cultural and tourism image by using the denoising algorithm; The second preset signal-to-noise ratio value is smaller than the first preset signal-to-noise ratio value, and the second preset signal-to-noise ratio value is 38-42db.
9. The method according to claim 8, characterized in that After determining whether the corresponding signal-to-noise ratio value is greater than or equal to a second preset signal-to-noise ratio value if the signal-to-noise ratio value is less than the first preset signal-to-noise ratio value, the method further includes: If the corresponding signal-to-noise ratio value is less than the second preset signal-to-noise ratio value, determining whether the corresponding signal-to-noise ratio value is greater than or equal to a third preset signal-to-noise ratio value; If the corresponding signal-to-noise ratio value is greater than or equal to the third preset signal-to-noise ratio value, the target cultural tourism image is enhanced, and the image enhancement method includes histogram equalization, contrast stretching, grayscale transformation and Fourier transformation; Acquire the noise type in the target cultural and tourism image, and determine the denoising algorithm corresponding to the target cultural and tourism image according to the noise type; Performing denoising processing on the target cultural and tourism image after image enhancement by using the denoising algorithm; The third preset signal-to-noise ratio value is smaller than the second preset signal-to-noise ratio value, and the third preset signal-to-noise ratio value is 22-28 db.
10. The method according to claim 9, characterized in that After determining whether the corresponding signal-to-noise ratio value is greater than or equal to a third preset signal-to-noise ratio value if the corresponding signal-to-noise ratio value is less than the second preset signal-to-noise ratio value, the method further includes: If the corresponding signal-to-noise ratio value is less than the third preset signal-to-noise ratio value, the corresponding target cultural and tourism image is discarded.
Citation Information
Patent Citations
Image noise reduction method and device, equipment and storage medium
CN116563162A
Image processing method and device, equipment and medium
CN117078789A
Elevator landing door corrosion grade evaluation method based on support vector machine model
CN117611873A
Image analysis method and system based on deep learning
CN118429242A
Image segmentation method and system based on Huber loss average teacher semi-supervised learning
CN118429357A