Picture cleaning method and device, storage medium and computer equipment
By constructing an unlabeled sample set and training a lightweight deep learning model, smartphones automatically identify and delete pictures that do not need to be retained, solving the problem of inefficient smartphone picture cleaning and achieving efficient picture cleaning.
Patent Information
- Application Number
- CN202510565881.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-30
- Publication Date
- 2025-09-23
AI Technical Summary
In the existing technology, the efficiency of smartphone image cleaning is low, and users need to manually browse a large number of images for manual screening, which increases time consumption.
Build an unlabeled sample set, train it with a deep learning model and perform lightweight processing to generate a lightweight image recognition model. This model can be used on smartphones for image recognition and screening, automatically identifying and deleting unnecessary images.
It reduces the workload of users' manual screening, improves the efficiency of image cleaning, and adapts to the resource limitations of smartphones.
Smart Images

Figure CN120689713A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of image cleaning, and in particular to an image cleaning method, apparatus, storage medium, and computer equipment. Background Art
[0002] As smartphone camera pixels increase, images captured by smartphones become clearer, but this also increases image size, requiring more storage space. However, not all images stored on smartphones are needed by users. If not promptly cleared, unwanted images will also take up a significant amount of smartphone storage space. Clearing these unwanted images requires users to manually browse through them, requiring manual identification and screening. The more images a smartphone stores, the more time-consuming image cleaning becomes. Consequently, the prior art suffers from the technical drawback of inefficient mobile phone image cleaning. Summary of the Invention
[0003] The purpose of this application is to overcome the shortcomings and deficiencies in the prior art and to provide a picture cleaning method, apparatus, storage medium and computer equipment that can improve the efficiency of mobile phone picture cleaning.
[0004] A first aspect of an embodiment of the present application provides an image cleaning method, which is applied to a cloud server and includes:
[0005] Constructing an unlabeled sample set of images to be cleaned based on a plurality of first positive sample images and a plurality of first negative sample images uploaded by a smartphone; wherein the first positive sample images are images to be cleaned, and the first negative sample images are images that do not need to be cleaned;
[0006] The initial deep learning model is trained according to the unlabeled sample set to obtain a deep image recognition model; the deep image recognition model is used to recognize the image to be cleaned;
[0007] Performing lightweight processing on the deep image recognition model to obtain a lightweight image recognition model;
[0008] The lightweight image recognition model is sent to the smart phone, so that the smart phone recognizes and filters the stored images through the lightweight image recognition model to obtain a plurality of target images to be cleaned.
[0009] Compared with the related art, this embodiment can construct an unlabeled sample set of pictures to be cleaned based on a first positive sample picture and several first negative sample pictures; wherein, the first positive sample picture is the picture to be cleaned, and the first negative sample picture is the picture that does not need to be cleaned; then the initial deep learning model is trained according to the unlabeled sample set to obtain a deep picture recognition model for identifying the pictures to be cleaned, and then a lightweight picture recognition model is obtained through lightweight processing, and the lightweight picture recognition model is sent to the smartphone, so that the smartphone uses the lightweight picture recognition model to identify and filter the stored pictures to obtain several target pictures to be cleaned, which can reduce the workload of users in manually identifying and filtering pictures to be cleaned and improve the cleaning efficiency of mobile phone pictures.
[0010] As an embodiment, the initial deep learning model includes a convolutional neural network and a classifier;
[0011] The step of training the initial deep learning model according to the unlabeled sample set to obtain a deep image recognition model includes:
[0012] Inputting multiple image samples in the unlabeled sample set into a convolutional neural network to obtain multiple sample features of the multiple image samples;
[0013] Performing dimensionality reduction processing on the multiple sample features to obtain multiple low-dimensional feature vectors;
[0014] Dividing the plurality of image samples into a plurality of sample clusters according to the plurality of low-dimensional feature vectors, and using the sample cluster of each of the image samples as a pseudo label;
[0015] Inputting the image sample into the classifier to obtain a predicted label of the sample feature;
[0016] The convolutional neural network and the classifier are trained according to the predicted labels and the pseudo labels to obtain the deep image recognition model.
[0017] In this embodiment, a convolutional neural network and a classifier are trained by using pseudo labels and predicted labels to obtain a deep image recognition model for identifying images to be cleaned.
[0018] As an embodiment, the step of training the convolutional neural network and the classifier according to the predicted labels and the pseudo labels to obtain the deep image recognition model includes:
[0019] Constructing a cross entropy loss function according to the predicted label, the pseudo label, the first parameter of the convolutional neural network, and the second parameter of the classifier;
[0020] The cross entropy loss function is solved using a gradient descent method, and the first parameter and the second parameter are updated by back propagation.
[0021] In this embodiment, the gradient descent method and back propagation update the first parameter of the convolutional neural network and the second parameter of the classifier, which can gradually reduce the loss value of the cross entropy loss function to train a deep image recognition model with high accuracy.
[0022] As an embodiment, the step of constructing a cross entropy loss function based on the predicted label, the pseudo label, the first parameter of the convolutional neural network, and the second parameter of the classifier includes:
[0023] The cross entropy loss function is obtained by the following formula:
[0024]
[0025] Where L(·) is the cross entropy loss function, θ is the first parameter, W is the second parameter, g W (f θ (x n )) is the predicted label of the nth image sample, N is the number of image samples, x n is the nth image sample, y n is the pseudo label of the nth image sample.
[0026] In this embodiment, through the above formula, a cross entropy loss function related to the predicted label, the pseudo label, the first parameter of the convolutional neural network and the second parameter of the classifier can be accurately obtained.
[0027] As an embodiment, after the step of sending the lightweight image recognition model to the smartphone and enabling the smartphone to identify and filter the stored images using the lightweight image recognition model to obtain a plurality of target images to be cleaned, the method further includes:
[0028] Training the deep image recognition model based on a plurality of second positive sample images and second negative sample images uploaded by the smartphone to update model parameters of the deep image recognition model; the second positive sample images are images that have been deleted and cleaned from the target images to be cleaned; and the second negative samples are images that have not been deleted and cleaned from the target images to be cleaned;
[0029] Performing lightweight processing on the deep image recognition model after updating the model parameters to obtain a new lightweight image recognition model, and obtaining lightweight model parameters of the new lightweight image recognition model;
[0030] The lightweight model parameters are sent to the smartphone to update the lightweight image recognition model of the smartphone.
[0031] In this embodiment, the deleted and cleaned pictures and the non-deleted and cleaned pictures in the target pictures to be cleaned are used as the second positive sample pictures and the second negative sample pictures to continue training the model to obtain the lightweight model parameters of the new lightweight picture recognition model and send them to the smartphone, which can improve the accuracy of the smartphone's lightweight picture recognition model in identifying and screening the target cleaned pictures next time.
[0032] The second embodiment of the present application discloses a method for screening images to be cleaned, which is applied to a smartphone. The method includes:
[0033] Uploading a plurality of first positive sample images and a plurality of first negative sample images to a cloud server for training an initial learning model of the cloud server to obtain a deep image recognition model;
[0034] Receive a lightweight image recognition model sent by a cloud server; wherein the lightweight image recognition model is a lightweight model obtained by lightweight processing of the deep image recognition model;
[0035] In response to the image cleaning operation, the lightweight image recognition model is used to identify and filter the images in the local storage space to obtain a number of target images to be cleaned.
[0036] Compared with the related technology, this embodiment can upload several first positive sample images and several first negative sample images to the cloud server for training to obtain a deep image recognition model, and then receive a lightweight image recognition model sent by the cloud server, and then use the lightweight image recognition model to identify and filter the images in the local storage space to obtain several target images to be cleaned. This can reduce the workload of users in manually identifying and filtering the images to be cleaned, and improve the cleaning efficiency of mobile phone images.
[0037] As an embodiment, after the step of obtaining a plurality of target images to be cleaned, the method further includes:
[0038] Uploading the deleted and cleaned images in the target images to be cleaned as first positive sample images to the cloud server, and uploading the undeleted and cleaned images as first negative sample images to the cloud server for training and updating the deep image recognition model and the lightweight image recognition model, thereby obtaining a new lightweight image recognition model;
[0039] The lightweight image recognition model of the smartphone is updated according to the lightweight model parameters sent by the cloud server; the lightweight model parameters are model parameters of the new lightweight image recognition model.
[0040] In this embodiment, the deleted and cleaned images and the non-deleted and cleaned images in the target images to be cleaned are uploaded to the cloud server as the second positive sample images and the second negative sample images to continue training the model. The lightweight image recognition model of the smartphone is updated according to the new lightweight model parameters obtained through training, which can improve the accuracy of the lightweight image recognition model of the smartphone in identifying and screening the target cleaning images next time.
[0041] A third aspect of the embodiments of the present application provides an image cleaning device, comprising:
[0042] An unlabeled sample acquisition module is configured to construct an unlabeled sample set of images to be cleaned based on a plurality of first positive sample images and a plurality of first negative sample images uploaded by a smartphone; wherein the first positive sample images are images to be cleaned, and the first negative sample images are images that do not need to be cleaned;
[0043] A model training module is used to train the initial deep learning model based on the unlabeled sample set to obtain a deep image recognition model; the deep image recognition model is used to recognize the image to be cleaned;
[0044] A lightweight model acquisition module, configured to perform lightweight processing on the deep image recognition model to obtain a lightweight image recognition model;
[0045] The lightweight model sending module is used to send the lightweight image recognition model to the smartphone, so that the smartphone can identify and filter the stored images through the lightweight image recognition model to obtain a number of target images to be cleaned.
[0046] Compared with the related art, this embodiment can construct an unlabeled sample set of pictures to be cleaned based on a first positive sample picture and several first negative sample pictures; wherein, the first positive sample picture is the picture to be cleaned, and the first negative sample picture is the picture that does not need to be cleaned; then the initial deep learning model is trained according to the unlabeled sample set to obtain a deep picture recognition model for identifying the pictures to be cleaned, and then a lightweight picture recognition model is obtained through lightweight processing, and the lightweight picture recognition model is sent to the smartphone, so that the smartphone uses the lightweight picture recognition model to identify and filter the stored pictures to obtain several target pictures to be cleaned, which can reduce the workload of users in manually identifying and filtering pictures to be cleaned and improve the cleaning efficiency of mobile phone pictures.
[0047] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the image cleaning method described above are implemented.
[0048] A fifth aspect of an embodiment of the present application provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable by the processor, wherein the processor implements the steps of the image cleaning method described above when executing the computer program.
[0049] In order to more clearly understand the present application, the specific implementation methods of the present application will be described below with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 This is a flowchart of an image cleaning method according to an embodiment of the present application applied to a cloud server.
[0051] Figure 2 This is a flowchart of an image cleaning method according to an embodiment of the present application applied to a smartphone.
[0052] Figure 3 This is a schematic diagram of module connections of an image cleaning device according to one embodiment of the present application.
[0053] 200. Image cleaning device; 201. Unlabeled sample acquisition module; 202. Model training module; 203. Lightweight model acquisition module; 204. Lightweight model distribution module. DETAILED DESCRIPTION
[0054] In order to make the objectives, technical solutions and advantages of the present application clearer, the embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
[0055] It should be clear that the embodiments described are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments of the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the embodiments of the present application.
[0056] When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. In the description of this application, it should be understood that the terms "first", "second", "third", etc. are only used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence, nor can they be understood as indicating or implying relative importance. For those of ordinary skill in the art, the specific meanings of the above terms in this application can be understood according to the specific circumstances. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include the plural forms, unless the context clearly indicates other meanings. The words "if" / "if" used herein can be interpreted as "at the time of" or "when" or "in response to determination".
[0057] In this application, unless otherwise specified, "plurality" refers to two or more. "And / or" describes a relationship between associated objects, indicating that three possible relationships exist. For example, "A and / or B" can mean: A exists alone, A and B exist simultaneously, or B exists alone. The character " / " generally indicates that the associated objects are in an "or" relationship.
[0058] See also Figure 1 , which is a flow chart of the image cleaning method of the first embodiment of the present application applied to a cloud server. The image cleaning method of the first embodiment of the present application is applied to a cloud server, including:
[0059] S10: Constructing an unlabeled sample set of images to be cleaned based on a plurality of first positive sample images and a plurality of first negative sample images uploaded by the smartphone; wherein the first positive sample images are images to be cleaned, and the first negative sample images are images that do not need to be cleaned.
[0060] The smartphone can access the local gallery through a software program, and then select a number of images to be cleaned from the local gallery according to a first image selection operation, and select a number of retained images that do not need to be cleaned from the local gallery according to a second image selection operation. The order of the first and second image selection operations is not limited, that is, the user can first perform the first image selection operation and then the second image selection operation; or the user can first perform the second image selection operation and then the first image selection operation. Any image in the smartphone's local gallery can only be selected by the first or second image selection operation, that is, any image cannot be selected by both the first and second image selection operations at the same time.
[0061] S20: Training an initial deep learning model according to the unlabeled sample set to obtain a deep image recognition model; the deep image recognition model is used to recognize the image to be cleaned.
[0062] Training the initial deep learning model based on an unlabeled sample set is considered unsupervised pretraining. Unsupervised training is a machine learning technique designed to enable AI models to automatically learn common features and patterns from large amounts of raw data without manually annotated data. The core of unsupervised pretraining is to allow the model to autonomously discover patterns and structures in the data. When processing image data, it automatically learns basic features such as edges and textures.
[0063] Unsupervised training primarily involves clustering, dimensionality reduction, generative tasks, anomaly detection, and feature learning tasks. Clustering involves dividing samples in a dataset into clusters based on similarity, so that samples within the same cluster are more similar, while samples between different clusters are less similar. Dimensionality reduction involves converting high-dimensional data into low-dimensional data through mapping or transformation, while preserving as much key information and features of the original data as possible to facilitate data processing, visualization, and subsequent analysis. Generative tasks involve learning the probability distribution of data and generating new data samples similar to the original data based on the learned distribution. Anomaly detection involves identifying data points in a dataset that are significantly different from the majority of data points. These anomalies may represent rare events, erroneous data, or potentially important information. Feature learning involves learning effective feature representations from raw data. These features can better describe the essential characteristics of the data and provide more valuable input for subsequent tasks.
[0064] S30: Performing lightweight processing on the deep image recognition model to obtain a lightweight image recognition model.
[0065] Lightweight processing of deep image recognition models includes but is not limited to model pruning, quantization, depthwise separable convolution, knowledge distillation, low-rank decomposition, and other methods.
[0066] Model pruning reduces the number of model parameters by removing unimportant connections or nodes. Pruning techniques are categorized into structural pruning and non-structural pruning. Structural pruning directly removes entire channels, convolution kernels, or layers, making it suitable for hardware acceleration. Non-structural pruning, on the other hand, removes individual weights or nodes, offering greater flexibility but potentially requiring specialized hardware support.
[0067] Quantization converts floating-point parameters in a model into low-precision integers or fixed-point numbers to reduce the model's storage requirements and computational complexity. Quantization methods include static quantization, dynamic quantization, and quantization-aware training (QAT). Static quantization is performed after training, dynamic quantization is performed during inference, and QAT considers quantization effects during training to reduce accuracy loss.
[0068] Depthwise separable convolution is a special convolution operation that can be divided into channel-by-channel convolution (DCT) and point-by-point convolution (PCT). Channel-by-channel convolution performs convolution operations on each channel independently, while point-by-point convolution combines the output feature maps of depthwise separable convolution to generate new feature maps. This approach can significantly reduce the number of model parameters and computational complexity.
[0069] Knowledge distillation is the process of guiding a small, simple model (the student model) through a large, complex model (the teacher model) so that the latter can learn the behavior of the former. During training, the student model uses not only the true labels but also the output of the teacher model as soft labels.
[0070] Low-rank decomposition is to decompose the weight matrix into the product of multiple small matrices through matrix decomposition techniques (such as singular value decomposition SVD), thereby reducing the number of model parameters.
[0071] Among them, lightweight processing can reduce the number of model parameters, computational complexity and storage requirements, while maintaining the original performance of the model as much as possible. Therefore, the obtained lightweight image recognition model can adapt to the operating conditions of smartphones.
[0072] S40: Sending the lightweight image recognition model to the smart phone, so that the smart phone recognizes and filters the stored images through the lightweight image recognition model to obtain a plurality of target images to be cleaned.
[0073] Compared with the related art, this embodiment can construct an unlabeled sample set of pictures to be cleaned based on a first positive sample picture and several first negative sample pictures; wherein, the first positive sample picture is the picture to be cleaned, and the first negative sample picture is the picture that does not need to be cleaned; then the initial deep learning model is trained according to the unlabeled sample set to obtain a deep picture recognition model for identifying the pictures to be cleaned, and then a lightweight picture recognition model is obtained through lightweight processing, and the lightweight picture recognition model is sent to the smartphone, so that the smartphone uses the lightweight picture recognition model to identify and filter the stored pictures to obtain several target pictures to be cleaned, which can reduce the workload of users in manually identifying and filtering pictures to be cleaned and improve the cleaning efficiency of mobile phone pictures.
[0074] In a feasible embodiment, the initial deep learning model includes a convolutional neural network and a classifier.
[0075] The step S20: training the initial deep learning model according to the unlabeled sample set to obtain a deep image recognition model includes:
[0076] S201: Inputting multiple image samples in the unlabeled sample set into a convolutional neural network to obtain multiple sample features of the multiple image samples.
[0077] Among them, the sample features can be expressed in the form of a one-dimensional vector.
[0078] S202: Perform dimensionality reduction processing on the multiple sample features to obtain multiple low-dimensional feature vectors.
[0079] Principal component analysis (PCA) may be used to implement dimensionality reduction processing on the feature output in the form of a one-dimensional vector.
[0080] S203: Divide the multiple image samples into multiple sample clusters according to the multiple low-dimensional feature vectors, and use the sample cluster of each image sample as a pseudo label.
[0081] The k-means clustering method can be used to cluster multiple image samples into multiple sample clusters. Specifically, by calculating the similarity (the default Euclidean distance), multiple image samples with high similarity are clustered into the same cluster, and K represents the number of clusters.
[0082] S204: Input the image sample into the classifier to obtain a predicted label of the sample feature.
[0083] The image sample may be input into a trainable linear classifier to obtain a predicted label of the sample feature.
[0084] S205: Training the convolutional neural network and the classifier according to the predicted labels and the pseudo labels to obtain the deep image recognition model.
[0085] In this embodiment, a convolutional neural network and a classifier are trained by using pseudo labels and predicted labels to obtain a deep image recognition model for identifying images to be cleaned.
[0086] In a feasible embodiment, the step of S205: training the convolutional neural network and the classifier according to the predicted label and the pseudo label to obtain the deep image recognition model includes:
[0087] S2051: Construct a cross entropy loss function according to the predicted label, the pseudo label, the first parameter of the convolutional neural network and the second parameter of the classifier.
[0088] The cross entropy loss function is obtained by the following formula:
[0089]
[0090] Where L(·) is the cross entropy loss function, θ is the first parameter, W is the second parameter, g W (f θ (x n )) is the predicted label of the nth image sample, N is the number of image samples, x n is the nth image sample, y n is the pseudo label of the nth image sample.
[0091] In this embodiment, through the above formula, a cross entropy loss function related to the predicted label, the pseudo label, the first parameter of the convolutional neural network and the second parameter of the classifier can be accurately obtained.
[0092] S2052: Use the gradient descent method to solve the cross entropy loss function, and backpropagate to update the first parameter and the second parameter.
[0093] Gradient descent is used to minimize a function, typically a loss function or a risk function. The gradient of this function with respect to the model parameters (weights) points to the direction in which the function value increases most rapidly. Gradient descent uses this information to update the parameters, causing the function value to gradually decrease. In this embodiment, gradient descent is used to minimize the cross-entropy loss function. The gradient descent method used can be full-batch gradient descent, stochastic gradient descent, or mini-batch stochastic gradient descent.
[0094] In this embodiment, the gradient descent method and back propagation update the first parameter of the convolutional neural network and the second parameter of the classifier, which can gradually reduce the loss value of the cross entropy loss function to train a deep image recognition model with high accuracy.
[0095] In a feasible embodiment, after the step of sending the lightweight image recognition model to the smartphone and enabling the smartphone to identify and filter the stored images using the lightweight image recognition model to obtain a plurality of target images to be cleaned, the following steps are included:
[0096] S50: Training the deep image recognition model based on a plurality of second positive sample images and second negative sample images uploaded by the smartphone to update model parameters of the deep image recognition model; the second positive sample images are images that have been deleted and cleaned from the target images to be cleaned; the second negative samples are images that have not been deleted and cleaned from the target images to be cleaned.
[0097] Among them, the process of continuing to train the deep image recognition model based on several second positive sample images and second negative sample images can refer to the process of training the initial deep learning model based on the unlabeled sample set, which will not be repeated here.
[0098] S60: performing lightweight processing on the deep image recognition model after the model parameters are updated to obtain a new lightweight image recognition model, and acquiring lightweight model parameters of the new lightweight image recognition model.
[0099] S70: Send the lightweight model parameters to the smartphone to update the lightweight image recognition model of the smartphone.
[0100] In this embodiment, the deleted and cleaned pictures and the non-deleted and cleaned pictures in the target pictures to be cleaned are used as the second positive sample pictures and the second negative sample pictures to continue training the model to obtain the lightweight model parameters of the new lightweight picture recognition model and send them to the smartphone, which can improve the accuracy of the smartphone's lightweight picture recognition model in identifying and screening the target cleaned pictures next time.
[0101] See also Figure 2 The second embodiment of the present application provides a method for screening images to be cleaned, which is applied to a smartphone. The method includes:
[0102] S1: Upload several first positive sample images and several first negative sample images to the cloud server for training the initial learning model of the cloud server to obtain a deep image recognition model.
[0103] S2: Receive a lightweight image recognition model sent by a cloud server; wherein the lightweight image recognition model is a lightweight model obtained by lightweight processing of the deep image recognition model.
[0104] S3: In response to the image cleaning operation, the images in the local storage space are identified and screened by the lightweight image recognition model to obtain a number of target images to be cleaned.
[0105] Compared with the related technology, this embodiment can upload several first positive sample images and several first negative sample images to the cloud server for training to obtain a deep image recognition model, and then receive a lightweight image recognition model sent by the cloud server, and then use the lightweight image recognition model to identify and filter the images in the local storage space to obtain several target images to be cleaned. This can reduce the workload of users in manually identifying and filtering the images to be cleaned, and improve the cleaning efficiency of mobile phone images.
[0106] In a feasible embodiment, after the step of obtaining a plurality of target images to be cleaned, the method further includes:
[0107] S4: Uploading the deleted and cleaned images in the target images to be cleaned as the first positive sample images to the cloud server, and uploading the undeleted and cleaned images as the first negative sample images to the cloud server for training and updating the deep image recognition model and the lightweight image recognition model, thereby obtaining a new lightweight image recognition model.
[0108] S5: updating the lightweight image recognition model of the smartphone according to the lightweight model parameters sent by the cloud server; the lightweight model parameters are model parameters of the new lightweight image recognition model.
[0109] In this embodiment, the deleted and cleaned images and the non-deleted and cleaned images in the target images to be cleaned are uploaded to the cloud server as the second positive sample images and the second negative sample images to continue training the model. The lightweight image recognition model of the smartphone is updated according to the new lightweight model parameters obtained through training, which can improve the accuracy of the lightweight image recognition model of the smartphone in identifying and screening the target cleaning images next time.
[0110] It should be noted that the method for screening images to be cleaned for smartphones provided in the second embodiment of the present application belongs to the same concept as the method for screening images to be cleaned for cloud servers provided in the first embodiment of the present application. The implementation process is detailed in the first embodiment and will not be repeated here.
[0111] See also Figure 3 The third embodiment of the present application provides a picture cleaning device 200, comprising:
[0112] The unlabeled sample acquisition module 201 is configured to construct an unlabeled sample set of images to be cleaned based on a plurality of first positive sample images and a plurality of first negative sample images uploaded by a smartphone; wherein the first positive sample images are images to be cleaned, and the first negative sample images are images that do not need to be cleaned;
[0113] A model training module 202 is configured to train an initial deep learning model based on the unlabeled sample set to obtain a deep image recognition model; the deep image recognition model is configured to recognize images to be cleaned;
[0114] A lightweight model acquisition module 203 is used to perform lightweight processing on the deep image recognition model to obtain a lightweight image recognition model;
[0115] The lightweight model sending module 204 is used to send the lightweight image recognition model to the smartphone, so that the smartphone can identify and filter the stored images through the lightweight image recognition model to obtain a number of target images to be cleaned.
[0116] It should be noted that the picture cleaning device provided in the third embodiment of the present application only uses the division of the above-mentioned functional modules as an example when executing the picture cleaning method. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the picture cleaning device provided in the second embodiment of the present application and the picture cleaning method of the first embodiment of the present application are of the same concept. The implementation process thereof is detailed in the method embodiment and will not be repeated here.
[0117] A fourth embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the image cleaning method described above are implemented.
[0118] The fifth embodiment of the present application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable by the processor, wherein the processor implements the steps of the above-mentioned image cleaning method when executing the computer program.
[0119] The device embodiments described above are merely illustrative, wherein the components described as separate parts may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present application. Those of ordinary skill in the art can understand and implement the present invention without inventive effort.
[0120] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0121] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the function selected in the process. Figure 1 a process or multiple processes and / or boxes Figure 1function selected in a box or multiple boxes.
[0122] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 steps for the function selected in a box or multiple boxes.
[0123] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0124] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0125] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.
[0126] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
[0127] The above are merely embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should be included within the scope of the claims of the present application.
Claims
1. A method for screening images to be cleaned, characterized in that: Applied to cloud servers, including: Constructing an unlabeled sample set of images to be cleaned based on a plurality of first positive sample images and a plurality of first negative sample images uploaded by a smartphone; wherein the first positive sample images are images to be cleaned, and the first negative sample images are images that do not need to be cleaned; The initial deep learning model is trained according to the unlabeled sample set to obtain a deep image recognition model; the deep image recognition model is used to recognize the image to be cleaned; Performing lightweight processing on the deep image recognition model to obtain a lightweight image recognition model; The lightweight image recognition model is sent to the smart phone, so that the smart phone recognizes and filters the stored images through the lightweight image recognition model to obtain a plurality of target images to be cleaned.
2. The method for screening images to be cleaned according to claim 1, wherein: The initial deep learning model includes a convolutional neural network and a classifier; The step of training the initial deep learning model according to the unlabeled sample set to obtain a deep image recognition model includes: Inputting multiple image samples in the unlabeled sample set into a convolutional neural network to obtain multiple sample features of the multiple image samples; Performing dimensionality reduction processing on the multiple sample features to obtain multiple low-dimensional feature vectors; Dividing the plurality of image samples into a plurality of sample clusters according to the plurality of low-dimensional feature vectors, and using the sample cluster of each of the image samples as a pseudo label; Inputting the image sample into the classifier to obtain a predicted label of the sample feature; The convolutional neural network and the classifier are trained according to the predicted labels and the pseudo labels to obtain the deep image recognition model.
3. The method for screening images to be cleaned according to claim 2, wherein: The step of training the convolutional neural network and the classifier according to the predicted labels and the pseudo labels to obtain the deep image recognition model includes: Constructing a cross entropy loss function according to the predicted label, the pseudo label, the first parameter of the convolutional neural network, and the second parameter of the classifier; The cross entropy loss function is solved using a gradient descent method, and the first parameter and the second parameter are updated by back propagation.
4. The method for screening images to be cleaned according to claim 3, wherein: The step of constructing a cross entropy loss function according to the predicted label, the pseudo label, the first parameter of the convolutional neural network and the second parameter of the classifier comprises: The cross entropy loss function is obtained by the following formula: Where L(·) is the cross entropy loss function, θ is the first parameter, W is the second parameter, g W (f θ (x n )) is the predicted label of the nth image sample, N is the number of image samples, x n is the nth image sample, y n is the pseudo label of the nth image sample.
5. The method for screening images to be cleaned according to claim 1, wherein: After the step of sending the lightweight image recognition model to the smartphone and enabling the smartphone to identify and filter the stored images using the lightweight image recognition model to obtain a plurality of target images to be cleaned, the method further includes: Training the deep image recognition model based on a plurality of second positive sample images and second negative sample images uploaded by the smartphone to update model parameters of the deep image recognition model; the second positive sample images are images that have been deleted and cleaned from the target images to be cleaned; and the second negative samples are images that have not been deleted and cleaned from the target images to be cleaned; Performing lightweight processing on the deep image recognition model after updating the model parameters to obtain a new lightweight image recognition model, and obtaining lightweight model parameters of the new lightweight image recognition model; The lightweight model parameters are sent to the smartphone to update the lightweight image recognition model of the smartphone.
6. A method for screening images to be cleaned, characterized in that: Applied to smartphones, the methods include: Uploading a plurality of first positive sample images and a plurality of first negative sample images to a cloud server for training an initial learning model of the cloud server to obtain a deep image recognition model; Receive a lightweight image recognition model sent by a cloud server; wherein the lightweight image recognition model is a lightweight model obtained by lightweight processing of the deep image recognition model; In response to the image cleaning operation, the lightweight image recognition model is used to identify and filter the images in the local storage space to obtain a number of target images to be cleaned.
7. The image cleaning method according to claim 6, characterized in that: After the step of obtaining a plurality of target images to be cleaned, the method further includes: Uploading the deleted and cleaned images in the target images to be cleaned as first positive sample images to the cloud server, and uploading the undeleted and cleaned images as first negative sample images to the cloud server for training and updating the deep image recognition model and the lightweight image recognition model, thereby obtaining a new lightweight image recognition model; The lightweight image recognition model of the smartphone is updated according to the lightweight model parameters sent by the cloud server; the lightweight model parameters are model parameters of the new lightweight image recognition model.
8. A picture cleaning device, characterized in that: include: An unlabeled sample acquisition module is configured to construct an unlabeled sample set of images to be cleaned based on a plurality of first positive sample images and a plurality of first negative sample images uploaded by a smartphone; wherein the first positive sample images are images to be cleaned, and the first negative sample images are images that do not need to be cleaned; A model training module is used to train the initial deep learning model based on the unlabeled sample set to obtain a deep image recognition model; the deep image recognition model is used to recognize the image to be cleaned; A lightweight model acquisition module, configured to perform lightweight processing on the deep image recognition model to obtain a lightweight image recognition model; The lightweight model sending module is used to send the lightweight image recognition model to the smartphone, so that the smartphone can identify and filter the stored images through the lightweight image recognition model to obtain a number of target images to be cleaned.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the image cleaning method according to any one of claims 1 to 7 are implemented.
10. A computer device, characterized in that: The method comprises a memory, a processor, and a computer program stored in the memory and executable by the processor, wherein the processor implements the steps of the image cleaning method according to any one of claims 1 to 7 when executing the computer program.