A method and system for automatic focusing of cultural relics photography based on deep learning
Through the deep learning-based autofocus method for cultural relics shooting, the central point coordinates and clarity score of the focus area are calculated using convolutional neural network, which solves the shortcomings of focus accuracy and speed in complex environments in traditional methods, and achieves a more efficient and accurate autofocus effect.
Patent Information
- Application Number
- CN202411881499.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-04-01
AI Technical Summary
Traditional cultural relics shooting methods rely on artificial focus, and their accuracy and efficiency are limited. Especially in complex shooting environments, such as low light or complex backgrounds, traditional algorithms cannot provide sufficiently accurate and rapid focus adjustment.
Using the deep learning-based autofocus method for cultural relics shooting, the convolutional neural network CNN model is constructed by collecting and preprocessing cultural relics images, the center point coordinates and clarity scores of the focus area are calculated, and the focal length of the lens is adjusted according to the clarity score.
It improves the accuracy of focus area recognition and image clarity evaluation, enhances the adaptability and reliability of the model in practical applications, and can achieve more accurate and fast autofocus in complex environments.
Smart Images

Figure CN119743671A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of automated cultural relic photography, and in particular to a method and system for automatically focusing cultural relic photography based on deep learning. Background Art
[0002] With the rapid development of digital image processing technology and deep learning technology, the application of image processing in various fields has made significant progress. Especially in the field of cultural relics protection and photography, the application of image technology is becoming more and more important. Cultural relic photography not only requires high-quality images, but also requires images to remain clear and detailed under different lighting, angles and distances. Traditional cultural relic photography methods mostly rely on manual focus, which is limited in accuracy and efficiency. Especially when photographing a large number of cultural relics or conducting long-term monitoring, manual focus operations are time-consuming and error-prone. How to improve the efficiency and image quality of cultural relic photography through automated methods has become an important research topic in this field.
[0003] Although existing autofocus methods have made some progress, there are still many shortcomings when dealing with cultural relics photography. Traditional methods are also limited in focusing accuracy and speed. Especially in complex shooting environments, such as low light or complex backgrounds, traditional algorithms often cannot provide sufficiently accurate and fast focus adjustments. Summary of the invention
[0004] In view of the above existing problems, the present invention is proposed.
[0005] Therefore, the present invention provides an automatic focusing method and system for photographing cultural relics based on deep learning to solve the problem that traditional methods are also limited in focusing accuracy and speed, especially in complex shooting environments, such as low light or complex backgrounds, traditional algorithms often cannot provide sufficiently accurate and rapid focus adjustments.
[0006] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0007] In a first aspect, the present invention provides an automatic focusing method for photographing cultural relics based on deep learning, which includes collecting and preprocessing cultural relic images, constructing a convolutional neural network (CNN) model to calculate the coordinates of the center point of the focus area; calculating the clarity score of the focus area, and calculating the focal length of the adjusted lens based on the clarity score; constructing a visualization interface to display the focal length of the adjusted lens, and storing, collecting and analyzing the generated cultural relic images.
[0008] As a preferred solution of the deep learning-based automatic focusing method for photographing cultural relics of the present invention, wherein: the collecting and preprocessing of cultural relic images refers to photographing and collecting cultural relic images using a single-lens reflex camera, and preprocessing the collected cultural relic images;
[0009] The preprocessing includes performing denoising on the cultural relic image using a Gaussian filtering algorithm, resizing the cultural relic image using a bilinear interpolation method, and normalizing the resized cultural relic image.
[0010] As a preferred solution of the deep learning-based automatic focusing method for photographing cultural relics of the present invention, wherein: constructing a convolutional neural network (CNN) model to calculate the coordinates of the center point of the focus area refers to collecting and preprocessing historical cultural relic images with labels to generate a training set;
[0011] Constructing a convolutional neural network CNN model includes input layer, convolution layer, pooling layer and fully connected output layer:
[0012] Define the format of the input layer as the normalized cultural relic image;
[0013] Use convolutional layers to extract feature maps F out (i,j), the formula is:
[0014]
[0015] Where k is the size of the convolution kernel, I(i,j) is the normalized cultural relic image, W(z,r) is the weight of the convolution kernel, and z and r are the offsets of the convolution kernel;
[0016] Use max pooling to reduce the feature map F out The size of (i,j) is given by:
[0017] F cin (i,j)=max{F out (i+m,j+n)},
[0018] where F cin (i, j) is the output of the pooling layer, m and n are the offsets of the pooling window;
[0019] The output of the pooling layer F cin (i,j) is flattened into a one-dimensional vector F end , input to the fully connected output layer to obtain the coordinates of the center point of the focus area The formula is:
[0020]
[0021] Where Q is the weight matrix of the fully connected layer, and b is the bias term of the fully connected layer;
[0022] Use the training set to train the convolutional neural network (CNN) model, and use the cross entropy loss function and Adam optimizer to iteratively optimize the parameters;
[0023] Input the normalized cultural relic image into the trained convolutional neural network (CNN) model to obtain the center point coordinates of the focal area.
[0024] As a preferred solution of the deep learning-based automatic focusing method for photographing cultural relics of the present invention, wherein: the calculation of the clarity score of the focus area refers to using single-point focus to set the width of the focus area to u and the height to h;
[0025] Calculate the bounding box of the focus area including the coordinates of the upper left corner (x left ,y top ) and the lower right corner coordinate (x right ,y tom ), the formula is:
[0026]
[0027] According to the upper left corner coordinate (x left ,y top ) and the lower right corner coordinate (x right ,y tom ), generate the pixel set R of the focus area, the formula is:
[0028] R={(x,y)|x left ≤x≤x right ,y top ≤y≤y tom},
[0029] Where (x, y) is the pixel coordinate of the focus area;
[0030] Use the Sobel operator to calculate the horizontal gradient value G of the pixel coordinates of the focus area x (x, y) and the vertical gradient value G y (x,y);
[0031] According to the horizontal gradient value G x (x, y) and the vertical gradient value G y (x, y), use the Euclidean norm method to calculate the gradient magnitude G(x, y), the formula is:
[0032]
[0033] Calculate the mean value of the gradient amplitude G(x,y) in the pixel set R of the focus area to obtain the clarity score of the focus area. The formula is:
[0034]
[0035] Among them C tar Rate the sharpness of the focused area.
[0036] As a preferred solution of the deep learning-based automatic focusing method for photographing cultural relics of the present invention, wherein: the calculation of the focal length of the adjusted lens according to the clarity score refers to setting a target clarity threshold using the percentile method of the clarity distribution, and calculating the clarity difference ΔC between the clarity score of the focus area and the target clarity threshold;
[0037] According to the difference in clarity ΔC, the required focal length adjustment Δf is calculated using the formula:
[0038] Δf=p·ΔC,
[0039] Where p is an empirical constant, which represents the sensitivity of focal length to the difference in sharpness;
[0040] According to the calculated focal length adjustment amount, calculate the focal length f of the lens after adjustment new , the formula is:
[0041] f new =f cur +Δf,
[0042] where f cur is the current focal length.
[0043] As a preferred solution of the deep learning-based automatic focusing method for photographing cultural relics of the present invention, wherein: constructing a visual interface to display the focal length of the adjusted lens refers to using Tkinter to construct a visual interface to display the clarity score of the focus area and the focal length of the adjusted lens;
[0044] Users who have passed real-name verification are allowed to view the information.
[0045] As a preferred solution of the deep learning-based automatic focusing method for photographing cultural relics described in the present invention, the storing of the cultural relic images collected and analyzed refers to storing the collected cultural relic images and the focal length of the adjusted lens generated by the analysis in a database, setting security access measures, regularly performing integrity checks on the stored data and backup data, and synchronously storing the test results.
[0046] In a second aspect, the present invention provides a deep learning-based automatic focusing system for photographing cultural relics, comprising:
[0047] The collection and construction module is used to collect and preprocess the cultural relics images, build a convolutional neural network (CNN) model and calculate the coordinates of the center point of the focus area;
[0048] A scoring calculation module, used to calculate the clarity score of the focus area, and calculate the focal length of the adjusted lens according to the clarity score;
[0049] The visualization storage module is used to build a visualization interface to display the focal length of the adjusted lens and to store the artifact images generated by collection and analysis.
[0050] In a third aspect, the present invention provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: when the computer program is executed by the processor, any step of the deep learning-based automatic focusing method for photographing cultural relics as described in the first aspect of the present invention is implemented.
[0051] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program is executed by a processor, any step of the deep learning-based automatic focusing method for photographing cultural relics as described in the first aspect of the present invention is implemented.
[0052] The beneficial effects of the present invention are as follows: the present invention collects and preprocesses cultural relic images, constructs a convolutional neural network (CNN) model to calculate the coordinates of the center point of the focus area; calculates the clarity score of the focus area, and calculates the focal length of the adjusted lens according to the clarity score; improves the accuracy of focus area recognition and image clarity evaluation, and enhances the adaptability and reliability of the model in practical applications. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0054] Figure 1 This is a flow chart of the deep learning-based automatic focusing method for photographing cultural relics in Example 1.
[0055] Figure 2 Schematic diagram of the deep learning-based automatic focusing system for photographing cultural relics in Example 1. DETAILED DESCRIPTION
[0056] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the accompanying drawings.
[0057] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0058] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.
[0059] Example 1, reference Figure 1 and Figure 2 , which is the first embodiment of the present invention, provides a method for automatically focusing cultural relics based on deep learning, comprising the following steps:
[0060] S1, collect and pre-process the cultural relics images, build a convolutional neural network (CNN) model to calculate the center point coordinates of the focus area;
[0061] Specifically, collecting and preprocessing cultural relic images refers to using a single-lens reflex camera to photograph cultural relics to collect cultural relic images, and preprocessing the collected cultural relic images;
[0062] The preprocessing includes performing denoising on the cultural relic image using a Gaussian filtering algorithm, resizing the cultural relic image using a bilinear interpolation method, and normalizing the resized cultural relic image.
[0063] Using a SLR camera to capture images of cultural relics can ensure high image quality and detail retention. Cultural relics usually have delicate surface textures and complex morphological features. The high resolution and large aperture of SLR cameras enable these details to be clearly recorded, which is helpful for subsequent image processing and focus area positioning. Images after Gaussian filtering can more accurately extract the key features of cultural relics and avoid the negative impact of noise interference on deep learning model training and focus area recognition. In the process of resizing cultural relic images, bilinear interpolation can effectively retain the smooth transition of images and avoid common pixel distortion and jagged edges in the resizing process. It can not only reduce blur during image scaling, but also optimize image quality while retaining details, thereby improving the positioning accuracy of the focus area and ensuring that the details of the cultural relic image are not lost or misjudged. Normalization is an important step in the preprocessing of cultural relic images. It eliminates brightness deviations caused by uneven lighting or different camera settings by unifying the image pixel value range.
[0064] Furthermore, constructing a convolutional neural network (CNN) model to calculate the coordinates of the center point of the focus area refers to collecting and preprocessing labeled historical cultural relics images to generate a training set;
[0065] Constructing a convolutional neural network CNN model includes input layer, convolution layer, pooling layer and fully connected output layer:
[0066] Define the format of the input layer as the normalized cultural relic image;
[0067] Use convolutional layers to extract feature maps F out (i,j), the formula is:
[0068]
[0069] Where k is the size of the convolution kernel, I(i,j) is the normalized cultural relic image, (i+z,j+r) is the coordinate after aligning the current position of the convolution kernel with the position (i,j) in the normalized cultural relic image, W(z,r) is the weight of the convolution kernel, and z and r are the offsets of the convolution kernel;
[0070] Use max pooling to reduce the feature map F out The size of (i,j) is given by:
[0071] F cin (i,j)=max{F out (i+m,j+n)},
[0072] Among them, F cin (i, j) is the output of the pooling layer, m and n are the offsets of the pooling window;
[0073] The output of the pooling layer F cin (i,j) is flattened into a one-dimensional vector F end , input to the fully connected output layer to obtain the coordinates of the center point of the focus area The formula is:
[0074]
[0075] Where Q is the weight matrix of the fully connected layer, and b is the bias term of the fully connected layer;
[0076] Use the training set to train the convolutional neural network (CNN) model, and use the cross entropy loss function and Adam optimizer to iteratively optimize the parameters;
[0077] Input the normalized cultural relic image into the trained convolutional neural network (CNN) model to obtain the center point coordinates of the focal area.
[0078] CNN can automatically extract complex features from cultural relic images. Traditional focusing technology relies on manual adjustment and experience, while CNN can achieve more accurate autofocus in complex environments by learning patterns from large amounts of data. In different areas of the image, the convolution layer can capture low-level features such as edges, lines, and textures. This multi-level feature extraction method enables CNN to understand the details in the image, especially for cultural relic images with complex textures and subtle features. The convolution layer can effectively improve the accuracy of focus area positioning. Through maximum pooling, the pooling layer can effectively retain the most significant features in the image while reducing sensitivity to detail noise, which is very useful in cultural relic photography. The fully connected layer is particularly important in the training process. In the fully connected layer, all features are taken into comprehensive consideration, and the coordinates of the center point of the focus area are calculated by weighted summation. Through the fully connected layer, the model can identify a clear focus area in a complex cultural relic image, thereby achieving automatic focus. The cross entropy loss function is used to measure the gap between the center point of the focus area predicted by the model and the actual label, helping the model to optimize parameters. The Adam optimizer can accelerate the training process by dynamically adjusting the learning rate, avoiding the problems of slow convergence or local optimal solutions that may occur in traditional optimization methods, eliminating the lighting differences caused by different shooting conditions, and ensuring that the features of each image are similar during the model training process.
[0079] S2, calculating the clarity score of the focus area, and calculating the focal length of the adjusted lens according to the clarity score;
[0080] Specifically, calculating the sharpness score of the focus area refers to using single-point focus to set the width of the focus area to u and the height to h;
[0081] Calculate the bounding box of the focus area including the coordinates of the upper left corner (x left ,y top ) and the lower right corner coordinate (x right ,y tom ), the formula is:
[0082]
[0083] According to the upper left corner coordinate (x left ,y top ) and the lower right corner coordinate (x right ,y tom ), generate the pixel set R of the focus area, the formula is:
[0084] R={(x,y)|x left ≤x≤x right ,y top ≤y≤y tom},
[0085] Where (x, y) is the pixel coordinate of the focus area;
[0086] Use the Sobel operator to calculate the horizontal gradient value G of the pixel coordinates of the focus area x (x, y) and the vertical gradient value G y (x,y);
[0087] According to the horizontal gradient value G x (x, y) and the vertical gradient value G y (x, y), use the Euclidean norm method to calculate the gradient magnitude G(x, y), the formula is:
[0088]
[0089] Calculate the mean value of the gradient amplitude G(x,y) in the pixel set R of the focus area to obtain the clarity score of the focus area. The formula is:
[0090]
[0091] Among them C tar Rate the sharpness of the focused area.
[0092] By setting the width and height of the focus area and defining the bounding box of the focus area, the image area that needs to be analyzed can be accurately determined, allowing the system to focus on the most important part of the image, thereby reducing the interference of irrelevant areas on the calculation results. By defining the coordinates of the upper left corner and the lower right corner and calculating the bounding box of the focus area, the pixel set of the focus area can be clearly determined. Using the Sobel operator to calculate the horizontal and vertical gradient values of the focus area helps to extract the edge information of the image. The Sobel operator can efficiently detect the changing area in the image. By measuring the gradients in the horizontal and vertical directions, the detailed information of the focus area in the image can be obtained. The average value of the gradient amplitude in the focus area can be calculated, which can be used as a quantitative indicator of the clarity of the focus area, which is very important for the autofocus system. The clarity score can help the system accurately determine whether the focus is at the best position in the image when shooting high-detail targets such as cultural relics, thereby reducing the risk of focus errors and improving image quality and shooting efficiency. Through accurate clarity scores, the system can adaptively adjust the focal length to achieve more accurate focus, especially in dynamic shooting environments or more complex shooting scenes. The success rate of autofocus can be significantly improved. Compared with traditional manual focus methods, this automated processing method can greatly improve shooting efficiency and reduce the complexity of manual operations. It is especially suitable for shooting cultural relics that require high-precision focus. The calculation of the clarity score provides a quantitative basis for the automatic adjustment of the lens, making the focusing process more efficient and accurate, and ensuring that the captured images of cultural relics have ideal visual effects.
[0093] Further, calculating the focal length of the adjusted lens according to the clarity score means setting a target clarity threshold using a percentile method of clarity distribution, and calculating a clarity difference ΔC between the clarity score of the focus area and the target clarity threshold;
[0094] According to the difference in clarity ΔC, the required focal length adjustment Δf is calculated using the formula:
[0095] Δf=p·ΔC,
[0096] Where p is an empirical constant, which represents the sensitivity of focal length to the difference in sharpness;
[0097] According to the calculated focal length adjustment amount, calculate the focal length f of the lens after adjustment new , the formula is:
[0098] f new =f cur +Δf,
[0099] where f cur is the current focal length.
[0100] Through the percentile method of clarity distribution, the system can set a suitable target clarity threshold according to the clarity score distribution of different images. Using the percentile method to set the target clarity threshold can dynamically adjust the target according to the specific situation of the image to ensure that the best focus effect can be achieved for each shot. By quantifying the difference between the actual clarity of the focus area and the target clarity threshold, the system can accurately determine whether the focus is accurate. The calculation of the focus adjustment amount is closely related to the clarity difference. Such calculation can accurately control the adjustment range of the focus to ensure that the clarity of the focus area is within the optimal range. By adjusting the empirical constant, the system can adapt to the focus adjustment under different shooting conditions. The automatic focus adjustment method of the present invention can automatically identify whether the focus area has achieved the ideal clarity and automatically adjust the lens focal length by calculating the difference between the clarity score of the focus area and the target clarity threshold, and this automated technology can reduce errors in manual operation, improve shooting efficiency, and ensure that every detail of the cultural relic image can be accurately captured. It not only improves the accuracy of focusing, but also reduces the time for repeated adjustments during shooting, optimizes the entire shooting process, and can significantly improve work efficiency and reduce dependence on professional operators for work that requires a large amount of high-precision shooting, especially in the fields of cultural heritage protection and digital preservation.
[0101] S3, build a visual interface to display the focal length of the adjusted lens, and store the cultural relic images collected and analyzed;
[0102] Specifically, constructing a visual interface to display the focal length of the adjusted lens refers to using Tkinter to construct a visual interface to display the clarity score of the focus area and the focal length of the adjusted lens;
[0103] Users who have passed real-name verification are allowed to view the information.
[0104] The real-time display of parameters such as focus area, clarity score, and focal length adjustment on the graphical interface can help users provide real-time feedback on the progress and effect of image processing and improve operational efficiency. Through this visual interface, users can accurately adjust the focus area and clarity of the image during the shooting of cultural relics to ensure that the shooting quality meets expectations. The real-time feedback mechanism enables users to respond instantly during the shooting process and accurately adjust the focal length to ensure that the captured cultural relic images are clear and the details are perfect. Especially in the process of digital preservation of historical cultural relics, it can retain details to the greatest extent and provide high-quality images. The real-name verification function effectively prevents data leakage and information abuse, especially for scenarios involving high-value content such as cultural relic protection, ensuring the security and legal use of image data. This interactive design enables the system to not only have powerful automated image processing functions, but also have a graphical interface that is easy for users to operate. This hybrid mode that combines artificial intelligence and manual operation can effectively reduce human errors in the process of high-precision image processing and provide users with intuitive and immediate operational feedback.
[0105] Furthermore, storing the cultural relic images generated by collection and analysis means storing the collected cultural relic images and the focal length of the adjusted lens generated by the analysis in a database, setting up security access measures, regularly performing integrity checks on the stored data and backup data, and synchronously storing the test results.
[0106] By storing these data in a database, historical images and focal length information can be easily traced, compared and reprocessed, thereby improving the efficiency of cultural relics shooting and preservation. Security measures effectively prevent data from being viewed or tampered with by unauthorized users, thereby ensuring data security. By regularly performing integrity checks on stored data and backup data, the present invention can effectively detect whether the data has been damaged, lost or tampered with. By storing the test results, the system can automatically generate a test report to provide a clear record for data recovery and troubleshooting. Regular backups are performed to ensure that even in the event of an unexpected situation, the data can still be restored from the backup. Synchronous storage not only improves the real-time and reliability of data management, but also helps system administrators quickly locate data problems when problems arise, reducing the time and cost of fault recovery. This is crucial for application fields such as digital preservation of cultural relics and high-precision image processing, and can ensure that cultural relic data can be stored and used in a long-term, stable and secure manner.
[0107] This embodiment also provides a deep learning-based automatic focusing system for photographing cultural relics, including:
[0108] The collection and construction module is used to collect and preprocess the cultural relics images, build a convolutional neural network (CNN) model and calculate the coordinates of the center point of the focus area;
[0109] A scoring calculation module, used to calculate the clarity score of the focus area, and calculate the focal length of the adjusted lens according to the clarity score;
[0110] The visualization storage module is used to build a visualization interface to display the focal length of the adjusted lens and to store the artifact images generated by collection and analysis.
[0111] This embodiment also provides a computer device, which is suitable for the case of the automatic focusing method for photographing cultural relics based on deep learning, including: a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the automatic focusing method for photographing cultural relics based on deep learning as proposed in the above embodiment.
[0112] The computer device may be a terminal, and the computer device includes a processor, a memory, a communication interface, a display screen and an input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. The display screen of the computer device may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device may be a touch layer covering the display screen, or a key, trackball or touchpad provided on the housing of the computer device, or an external keyboard, touchpad or mouse, etc.
[0113] This embodiment also provides a storage medium on which a computer program is stored. When the program is executed by a processor, the method for automatically focusing cultural relics photography based on deep learning proposed in the above embodiment is implemented; the storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random Access Memory, SRAM for short), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM for short), erasable programmable read-only memory (Erasable Programmable Read Only Memory, EPROM for short), programmable read-only memory (Programmable Red-Only Memory, PROM for short), read-only memory (Read-Only Memory, ROM for short), magnetic storage, flash memory, disk or optical disk.
Claims
1. A method for automatically focusing cultural relics based on deep learning, characterized in that: include, Collect and pre-process the cultural relics images, and build a convolutional neural network (CNN) model to calculate the coordinates of the center point of the focus area; Calculate the clarity score of the focus area, and calculate the focal length of the adjusted lens according to the clarity score; Construct a visualization interface to display the focal length of the adjusted lens and store the artifact images generated by collection and analysis.
2. The method for automatically focusing cultural relics based on deep learning as claimed in claim 1, characterized in that: The collecting and preprocessing of cultural relic images refers to using a single-lens reflex camera to photograph cultural relics and collect cultural relic images, and preprocessing the collected cultural relic images; The preprocessing includes performing denoising on the cultural relic image using a Gaussian filtering algorithm, resizing the cultural relic image using a bilinear interpolation method, and normalizing the resized cultural relic image.
3. The method for automatically focusing cultural relics based on deep learning as claimed in claim 2, characterized in that: The constructing of the convolutional neural network (CNN) model to calculate the coordinates of the center point of the focal area refers to collecting and preprocessing the images of historical cultural relics with labels to generate a training set; Constructing a convolutional neural network CNN model includes input layer, convolution layer, pooling layer and fully connected output layer: Define the format of the input layer as the normalized cultural relic image; Use convolutional layers to extract feature maps F out (i,j), the formula is: Where k is the size of the convolution kernel, I(i,j) is the normalized cultural relic image, W(z,r) is the weight of the convolution kernel, and z and r are the offsets of the convolution kernel; Use max pooling to reduce the feature map F out The size of (i,j) is given by: F cin (i,j)=max{F out (i+m,j+n)}, Among them, F cin (i, j) is the output of the pooling layer, m and n are the offsets of the pooling window; The output of the pooling layer is F cin (i,j) is flattened into a one-dimensional vector F end , input to the fully connected output layer to obtain the coordinates of the center point of the focus area The formula is: Where Q is the weight matrix of the fully connected layer, and b is the bias term of the fully connected layer; Use the training set to train the convolutional neural network (CNN) model, and use the cross entropy loss function and Adam optimizer to iteratively optimize the parameters; Input the normalized cultural relic image into the trained convolutional neural network (CNN) model to obtain the center point coordinates of the focal area.
4. The method for automatically focusing cultural relics based on deep learning as claimed in claim 3, characterized in that: The calculation of the clarity score of the focus area refers to using single-point focus to set the width of the focus area to u and the height to h; Calculate the bounding box of the focus area including the coordinates of the upper left corner (x left ,y top ) and the lower right corner coordinate (x right ,y tom ), the formula is: According to the upper left corner coordinate (x left ,y top ) and the lower right corner coordinate (x right ,y tom ), generate the pixel set R of the focus area, the formula is: R={(x,y)|x left ≤x≤x right ,y top ≤y≤y tom }, Where (x, y) is the pixel coordinate of the focus area; Use the Sobel operator to calculate the horizontal gradient value G of the pixel coordinates of the focus area x (x, y) and the vertical gradient value G y (x,y); According to the horizontal gradient value G x (x, y) and the vertical gradient value G y (x, y), use the Euclidean norm method to calculate the gradient magnitude G(x, y), the formula is: Calculate the mean value of the gradient amplitude G(x,y) in the pixel set R of the focus area to obtain the clarity score of the focus area. The formula is: Among them C tar Rate the sharpness of the focused area.
5. The method for automatically focusing cultural relics based on deep learning as claimed in claim 4, characterized in that: Calculating the focal length of the adjusted lens according to the clarity score refers to setting a target clarity threshold using a percentile method of clarity distribution, and calculating a clarity difference ΔC between the clarity score of the focus area and the target clarity threshold; According to the difference in clarity ΔC, the required focal length adjustment Δf is calculated using the formula: Δf=p·ΔC, Where p is an empirical constant, which represents the sensitivity of focal length to the difference in sharpness; According to the calculated focal length adjustment amount, calculate the focal length f of the lens after adjustment new , the formula is: f new =f cur +Δf, where f cur is the current focal length.
6. The method for automatically focusing cultural relics based on deep learning as claimed in claim 5, characterized in that: The constructing a visual interface to display the focal length of the lens after adjustment refers to using Tkinter to construct a visual interface to display the clarity score of the focus area and the focal length of the lens after adjustment; Users who have passed real-name verification are allowed to view the information.
7. The method for automatically focusing cultural relics based on deep learning as claimed in claim 6, characterized in that: The storing of the cultural relic images collected and generated by analysis means storing the collected cultural relic images and the focal length of the adjusted lens generated by the analysis into a database, setting up security access measures, regularly performing integrity checks on the stored data and backup data, and synchronously storing the test results.
8. A deep learning-based automatic focusing system for photographing cultural relics, based on the deep learning-based automatic focusing method for photographing cultural relics according to any one of claims 1 to 7, characterized in that: include, The collection and construction module is used to collect and preprocess the cultural relics images, build a convolutional neural network (CNN) model and calculate the coordinates of the center point of the focus area; A scoring calculation module, used to calculate the clarity score of the focus area, and calculate the focal length of the adjusted lens according to the clarity score; The visualization storage module is used to build a visualization interface to display the focal length of the adjusted lens and to store the artifact images generated by collection and analysis.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the deep learning-based automatic focusing method for photographing cultural relics are implemented as described in any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the deep learning-based automatic focusing method for photographing cultural relics are implemented as described in any one of claims 1 to 7.