Automatic data classification and retrieval method based on image recognition in cloud storage

By building an image database on a cloud storage platform and utilizing deep learning feature extraction methods, combined with super-resolution reconstruction and dynamic range compression technology, the problem of low efficiency of traditional image retrieval methods in massive medical images is solved, achieving efficient and accurate Medical image search.

CN119293279AInactive Publication Date: 2025-01-10WUXI XINFENG IOT INTELLIGENT TECH CO LTD

Patent Information

Application Number
CN202411161533.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-23
Publication Date
2025-01-10
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Traditional text-based image retrieval methods are difficult to accurately describe the details and features in medical images, and are inefficient in retrieval in massive data, which cannot meet the real-time needs of medical research and teaching.

Method used

Build an image database on a cloud storage platform, use deep learning feature extraction methods to automatically extract feature descriptors of medical images, and build an image similarity map. The similarity calculation and sorting of feature descriptors are carried out, and the time attenuation factor optimization search results are introduced. Combining super-resolution reconstruction and dynamic range compression techniques to improve image quality.

Benefits of technology

It realizes efficient and accurate retrieval of medical images, significantly improves the search efficiency and accuracy, and meets the real-time needs of medical research and teaching.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119293279A_ABST
    Figure CN119293279A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image retrieval, and discloses an automatic data classification and retrieval method based on image recognition in cloud storage, which comprises the following steps of: firstly, constructing an image database containing medical image feature descriptors, storage positions and metadata on a cloud storage platform, and constructing an image similarity graph; the similarity relation between the medical images is expressed in a graph structure, and efficient retrieval is achieved. After a user uploads a to-be-queried medical image, the system preprocesses the to-be-queried medical image and obtains a feature descriptor by using a deep learning feature extraction method. And setting a similarity threshold, retrieving similar images from the image similarity graph, and sorting results according to similarity scores and time decay factors. And finally, displaying the retrieval result and the metadata thereof to the user in a list or grid form. According to the method, the problems of low efficiency and insufficient accuracy of a traditional text-based image retrieval method under the background of explosive growth of medical image data are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image retrieval technology, and in particular to an automatic data classification and retrieval method based on image recognition in cloud storage. Background Art

[0002] With the continuous advancement of medical technology and the popularization of medical imaging equipment, medical imaging data is showing an explosive growth trend. These imaging data play a vital role in medical research and teaching. Doctors often need to find medical images similar to specific cases for reference and diagnosis.

[0003] The traditional text-based image retrieval (TBIR) method manually adds descriptive text labels to each image, and then uses text retrieval technology to search. However, many details and features in medical images are difficult to describe accurately with words, especially for features such as abstract shapes, complex textures, and color changes, which are difficult to describe with text. In addition, the accuracy and comprehensiveness of text labels also directly affect the retrieval effect.

[0004] Moreover, the traditional retrieval system is often inefficient when facing massive medical image data. Due to the lack of efficient feature extraction and matching algorithms, the system needs to spend a lot of time to compare one by one, which is difficult to meet the real-time requirements in medical research and teaching. To this end, we propose an automatic data classification and retrieval method based on image recognition in cloud storage. Summary of the invention

[0005] The purpose of the present invention is to provide a method for automatic data classification and retrieval based on image recognition in cloud storage to solve the problems raised in the above background technology.

[0006] To achieve the above object, the present invention provides the following technical solution: a method for automatic classification and retrieval of data based on image recognition in cloud storage, the method comprising:

[0007] Building an image database on a cloud storage platform, wherein the image database stores data including feature descriptors, storage locations, and metadata of medical images, for supporting case data retrieval in medical research and teaching;

[0008] Use the image database to build an image similarity graph and represent the similarity relationship between medical images as a graph structure;

[0009] The user uploads the medical image to be queried through the client or web interface of the cloud storage service, and the image is input into the retrieval system as a query condition;

[0010] Preprocess uploaded medical images, including grayscale conversion, enhancing low-resolution images using super-resolution reconstruction techniques, and processing high-dynamic-range images using dynamic range compression algorithms;

[0011] Use deep learning feature extraction methods to extract features from preprocessed medical images and obtain feature descriptors of the images;

[0012] Set a similarity threshold, retrieve images whose similarity meets the preset threshold from the image similarity graph through feature descriptors, and sort the retrieval results according to the similarity score; in the calculation of the similarity score, introduce a time decay factor to give a higher weight to newly uploaded medical images;

[0013] According to the storage location information of each image in the search results, the corresponding medical imaging data is obtained;

[0014] All acquired medical imaging data and the corresponding metadata are collected as the final result and displayed to the user in the form of a list or grid.

[0015] Preferably, the image similarity graph uses medical images as nodes and the similarity between images as edge weights, and the similarity is obtained by calculating the distance between image feature descriptors, and the calculation method includes using Euclidean distance or cosine similarity algorithm.

[0016] Preferably, the time decay factor is determined according to the difference between the image upload time and the current time. The smaller the difference, the higher the weight. The weight calculation uses an exponential decay function, and the formula is:

[0017] Time decay weight = e -λ(当前时间-上传时间)

[0018] Among them, λ is the decay coefficient, which is used to control the speed of time decay. The final similarity score of each medical image is calculated by combining the similarity and the time decay weight. The final similarity score is obtained by calculating the product of the similarity and the time decay weight: the final similarity score = similarity × time decay weight.

[0019] Preferably, the step of enhancing the low-resolution image using super-resolution reconstruction technology includes:

[0020] Step 1: Represent the uploaded low-resolution medical image as a vector y∈R n , where n is the dimension of the image after vectorization;

[0021] Step 2: Construct the observation matrix H∈R m×n , used to simulate the degradation factors in the image acquisition process; the observation matrix is ​​further decomposed into the sampling matrix D, the fuzzy matrix B and the motion matrix M, that is, H = DBM, where m represents the dimension of the high-resolution image after vectorization;

[0022] Step 3: Based on the known low-resolution image y and observation matrix H, solve the high-resolution image x, and the solution equation is: y = Hx.

[0023] Preferably, the step of processing the high dynamic range image using a dynamic range compression algorithm comprises:

[0024] Step 1: Use a fast bidirectional filter to perform logarithmic domain decomposition on the uploaded high dynamic range medical image to decompose it into a basic layer and a detail layer;

[0025] Step 2: Perform a global brightness mapping algorithm on the base layer to compress the mapping slope of high brightness values ​​and expand the mapping range of intermediate brightness values; the specific formula is:

[0026] Loutput=a·log base (Linput+b)+c

[0027] Among them, L input Indicates the input brightness value, L output Represents the output brightness value, a, b, c are constants used to adjust the slope and range of the mapping, base is the logarithmic base, and the value is 2 or 10;

[0028] Step 3: Process the detail layer using a local tone mapping algorithm, including using a mapping function to obtain a new output value for each pixel in the image;

[0029] Step 4: Merge the processed basic layer with the detail layer to generate a medical image with dynamic range compression.

[0030] Preferably, a deep learning model is selected as a feature extractor, and the model is pre-trained on a large medical image dataset to extract representative and discriminative features from the medical images; the preprocessed medical images are input into the selected deep learning model to perform a forward propagation process; and a feature representation of the medical image is extracted from a specific layer of the deep learning model, and the feature representation is used as a feature descriptor of the image.

[0031] Preferably, the method of constructing an image similarity graph using an image database is:

[0032] S1: Traverse all medical images in the image database, and for each pair of medical images, perform the following operations:

[0033] i) extracting feature descriptors for each pair of medical images;

[0034] ii) calculating the similarity between the feature descriptors of the pair of medical images;

[0035] S2: Each pair of medical images and the similarity between them is regarded as a node pair in the graph, and the connection weight between the node pairs is the similarity of the pair of medical images;

[0036] S3: Use sparse matrix data structure to store image similarity graph;

[0037] S4: Use the KD tree spatial index structure to pre-index the image similarity graph.

[0038] Preferably, when a new medical image is added to the image database, the similarity between the new image and the existing images in the database is recalculated, and the image similarity graph is updated.

[0039] Preferably, in preprocessing the uploaded medical image, the method of graying the image is:

[0040] S1. Select the weighted method to convert the color image into a grayscale image, and use the formula GRAY = 0.3*R + 0.59*G + 0.11*B to calculate the grayscale value. R, G, and B in the formula represent the components of the pixel in the red, green, and blue color domains respectively.

[0041] S2, read the medical image data, traverse each pixel in the image, and obtain the RGB color value corresponding to each pixel;

[0042] S3, applying a color value conversion method, calling the formula in step S1 to convert the RGB color value of each pixel obtained in step S2, and obtaining a corresponding grayscale value;

[0043] S4. Apply the converted grayscale value to each pixel to generate a medical image grayscale image.

[0044] Compared with the prior art, the present invention has the following beneficial effects:

[0045] The present invention can automatically extract the key features of medical images and construct an image similarity graph through a deep learning feature extraction method, thereby realizing content-based image retrieval. Compared with traditional text-based image retrieval methods, the present invention can more accurately capture the details and features in medical images and improve the accuracy of retrieval.

[0046] At the same time, by using image similarity graphs and efficient feature matching algorithms, the present invention can quickly retrieve similar images from massive medical imaging data, significantly improving retrieval efficiency and meeting real-time requirements in medical research and teaching. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 A diagram showing the processing steps of the method of the present invention;

[0048] Figure 2 Diagram of steps for building image similarity graph;

[0049] Figure 3 This is a diagram of the steps for grayscale processing of an image. DETAILED DESCRIPTION

[0050] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0051] See also Figure 1-3 The present invention provides a technical solution: a method for automatic classification and retrieval of data based on image recognition in cloud storage, the method comprising:

[0052] An image database is built on the cloud storage platform. The database is used to store the feature descriptors, storage locations, and metadata of medical images, which is used as the basis for case data retrieval in medical research and teaching. Feature descriptors are obtained by deep learning feature extraction of medical images and are used to represent the unique features of images; storage locations record the specific locations of medical images in cloud storage for subsequent retrieval and access; metadata contains additional information related to medical images, such as patient information, shooting time, equipment, etc.

[0053] Using the feature descriptors in the image database, an image similarity graph is constructed. The graph structure represents the similarity relationship between medical images, where nodes represent medical images and edges represent the similarity between images. By calculating the distance or similarity measure between feature descriptors, the similarity relationship between images can be obtained and represented as the edge weight in the graph.

[0054] Users upload the medical image to be queried through the client or web interface of the cloud storage service. The image is input into the retrieval system as a query condition to retrieve similar medical images.

[0055] The uploaded medical images are preprocessed, including image grayscale, application of super-resolution reconstruction technology to enhance low-resolution images, and use of dynamic range compression algorithm to process high dynamic range images. The preprocessing steps are used to improve image quality and enhance the accuracy and efficiency of subsequent feature extraction.

[0056] The deep learning feature extraction method is used to extract features from the preprocessed medical images. By training a deep learning model (such as a convolutional neural network), high-level feature representations of medical images can be learned and used as feature descriptors, which will be used for subsequent similarity calculations and retrieval.

[0057] Set a similarity threshold and retrieve images whose similarity meets the preset threshold from the image similarity graph through feature descriptors. Sort the retrieval results according to the similarity score, where a time decay factor is introduced in the similarity score calculation to give a higher weight to newly uploaded medical images, which can ensure that the retrieval results are more in line with user needs and give priority to the latest medical images.

[0058] According to the storage location information of each image in the retrieval results, the corresponding medical imaging data is obtained from the cloud storage and provided to the user as the output of the retrieval results for further analysis and research.

[0059] Collect all acquired medical image data and the corresponding metadata as the final result, and display them to users in the form of a list or grid. Users can find case data similar to the medical image to be queried by viewing the search results, providing valuable reference for medical research and teaching.

[0060] The automatic data classification and retrieval method based on image recognition proposed in the present invention utilizes a cloud storage platform and image recognition technology to achieve efficient and accurate retrieval of massive medical imaging data. By constructing an image database and a similarity graph, the method can store and manage feature descriptors, storage locations and metadata of medical images, providing a rich data source for case data retrieval. At the same time, by utilizing deep learning feature extraction technology, the method can extract unique feature descriptors from medical images to represent high-level features of the images. By setting a similarity threshold and introducing a time decay factor, the method can retrieve cases similar to the medical images to be queried, and sort them according to the similarity score, giving priority to displaying the latest medical images. Finally, the retrieval results are displayed in a list or grid format, providing doctors with an intuitive reference, helping them make more accurate diagnosis and treatment decisions, and improving medical standards.

[0061] The present invention will be further described below in conjunction with Examples 1 to 5:

[0062] Embodiment 1:

[0063] The present invention adopts Euclidean distance or cosine similarity algorithm to measure the similarity between images.

[0064] Euclidean distance is a method to measure the actual distance between two points in multidimensional space. In image similarity calculation, the feature descriptors of the images can be regarded as points in multidimensional space and the Euclidean distance between them can be calculated. Suppose the feature descriptors of two images are X = (x1, x2, ..., x n ) and Y=(y1,y2,…,y n ), where n is the dimension of the feature descriptor. Then the Euclidean distance D between them can be calculated by the following formula:

[0065]

[0066] The smaller the Euclidean distance, the more similar the two images are.

[0067] Cosine similarity is a way to measure how similar two vectors are in direction.

[0068] In the image similarity calculation, the feature descriptors of the images can be regarded as vectors, and the cosine similarity between them can be calculated. Suppose the feature descriptors of the two images are A = (a1, a, ..., a n ) and B=(b1,b2,...,b n ), where n is the dimension of the feature descriptor, then the cosine similarity cos(θ) between them can be calculated by the following formula:

[0069]

[0070] Among them, A·B represents the dot product of vectors A and B, |A| and |B| represent the modulus lengths of vectors A and B respectively, and the closer the cosine similarity value is to 1, the more similar the two images are.

[0071] The time decay factor is used to measure the degree to which the importance of medical images decreases over time. It is calculated based on the difference between the upload time and the current time of the image through an exponential decay function. The decay coefficient (λ) is a pre-set positive number used to control the speed of time decay. The larger the value of λ, the faster the time decay, that is, the greater the impact of the timeliness of the image on the final similarity score. Conversely, the smaller the value of λ, the slower the time decay, and the weight of the historical value of the image in the score is relatively high.

[0072] Calculate the difference (Δt) between the current time and the time when the medical image was uploaded, usually in seconds, substitute the time difference Δt into the exponential decay function, and calculate the time decay weight. The formula is as follows:

[0073] Time decay weight = e -λ× Δ t =e -λ×(当前时间-上传时间)

[0074] Here, e is the base of natural logarithms, which is approximately equal to 2.71828.

[0075] Multiply the basic similarity by the time decay weight to get the final similarity score for each image. The formula is as follows:

[0076] Final similarity score = similarity × time decay weight

[0077] The retrieved images are sorted according to the final similarity score, and the images with higher scores are more similar to the query image.

[0078] Embodiment 2:

[0079] In the automatic data classification and retrieval method based on image recognition in the cloud storage of the present invention, in particular, for the data processing of low-resolution medical images, super-resolution reconstruction technology is used to enhance its clarity. The working principle of this technology is mainly based on the signal processing and image processing theory in mathematics. By simulating the degradation factors (such as sampling, blurring, motion, etc.) that the image may experience during the acquisition process, an observation matrix H is constructed, which can reflect the impact of these degradation factors on the image.

[0080] In the process of super-resolution reconstruction, the input low-resolution image needs to be vectorized first to obtain a vector y representing the image information. Then, based on the known observation matrix H and the image vector y, the high-resolution image vector x is estimated by solving the linear equation system y = Hx. This equation system is actually an inverse problem, because restoring a high-resolution image from a low-resolution image is a process of information loss, so the solution process needs to use the prior knowledge of the image and the constraints to obtain a reasonable solution. The following is a detailed description of the method:

[0081] Step 1: Image vectorization

[0082] First, the uploaded low-resolution medical image is vectorized and represented as a vector y, where y belongs to the n-dimensional space of the real number domain R (y∈R n ), n is the dimension of the image after vectorization, and the image data is converted into a mathematical form that can be processed by a computer. The specific method is:

[0083] Represent an image as a matrix where each row of the matrix represents a pixel of the image and each column represents a color channel of the pixel (for grayscale images, there is only one channel).

[0084] The image matrix is ​​vectorized, that is, the matrix elements are arranged into a one-dimensional vector by row or column, and finally the vectorized image vector y is stored in the computer memory.

[0085] Step 2: Construct the observation matrix

[0086] Next, we construct the observation matrix H, which belongs to the m×n dimensional space (H∈R m×n ), where m represents the dimension of the high-resolution image after vectorization. The measurement matrix H is used to simulate the degradation factors in the image acquisition process, including sampling, blurring, and motion. In order to simulate these degradation factors more accurately, the measurement matrix H is further decomposed into the sampling matrix D, the blurring matrix B, and the motion matrix M, that is, H = D × B × M.

[0087] Step 3: Solve the high-resolution image

[0088] After obtaining the low-resolution image vector y and the observation matrix H, a mathematical method is used to solve the high-resolution image vector x. The solution process is based on the linear equation system y = Hx, where x is the high-resolution image vector to be solved. By solving this equation system, a high-resolution image corresponding to the original low-resolution image can be obtained.

[0089] Super-resolution reconstruction technology can restore images with higher resolution than the original images, making the detailed information in the image richer and clearer. It is particularly important for the analysis of medical images, as more useful information can be extracted from clearer images.

[0090] For uploaded high dynamic range medical imaging images, a dynamic range compression algorithm is used to process the high dynamic range (HDR) image and map the brightness range of the HDR image into the display range of the low dynamic range (LDR) image.

[0091] The steps of processing high dynamic range images using dynamic range compression algorithms include:

[0092] Step 1: Image Decomposition

[0093] For uploaded high dynamic range medical images, we first use a fast bidirectional filter to perform logarithmic domain decomposition, which can efficiently decompose the image into a basic layer and a detail layer. The basic layer mainly contains the overall brightness information of the image, while the detail layer contains the local details and edge information of the image.

[0094] Step 2: Base layer global brightness map

[0095] The global brightness mapping algorithm is used to process the basic layer obtained by decomposition. This algorithm aims to compress the mapping slope of high brightness values ​​and expand the mapping range of intermediate brightness values. In specific implementation, the following formula is used for brightness mapping:

[0096] L output =a·log base (L input +b)+c

[0097] Among them, Linput Indicates the input brightness value, L output Represents the output brightness value. a, b, and c are constants used to adjust the slope and range of the mapping. base is the logarithmic base, which takes a value of 2 or 10. By adjusting these parameters, the effect of brightness mapping can be effectively controlled to meet different image requirements.

[0098] Step 3: Detail layer local tone mapping

[0099] The local tone mapping algorithm is used to process the decomposed detail layer. This algorithm focuses on the local contrast of the image and adjusts the contrast of the image through a mapping function to obtain a new output value for each pixel. This processing method can retain the detail information of the image while avoiding the loss of details that may be caused by the global brightness mapping process.

[0100] Step 4: Image merging

[0101] Finally, the processed basic layer is merged with the detail layer to generate a medical image with dynamic range compression. The merging process needs to ensure that the two layers of images are aligned in space and brightness to ensure the integrity and consistency of the final image.

[0102] Embodiment 3:

[0103] This embodiment selects Convolutional Neural Network (CNN) as the feature extractor, and specifically uses the pre-trained ResNet (residual network) model as the basic architecture, because it can effectively solve the gradient vanishing problem in deep network training and perform well in large-scale image recognition tasks. The model architecture is as follows:

[0104] Input layer: Receives preprocessed medical image data. The input size is adjusted according to the specific data set, such as 224x224 pixel RGB images.

[0105] Convolutional layer: Multi-layer convolution kernels are used for feature extraction. Each convolution layer is followed by a ReLU activation function to increase nonlinearity, and a batch normalization layer to accelerate the training process and reduce overfitting.

[0106] Pooling layer: A maximum pooling layer is inserted between convolutional layers to reduce the dimension of the feature map while retaining important feature information.

[0107] Residual connection: Introducing residual connections between specific layers allows gradients to propagate directly across multiple layers, solving the problem of deep network training.

[0108] Fully connected layer (optional): In the feature extraction stage, the fully connected layer is usually not used directly for classification, but is determined by the position of the feature layer that needs to be extracted.

[0109] Select the output of the deeper layers in the model as the feature representation. For example, in the ResNet-50 model, you can select the output of the second-to-last layer (that is, before the global average pooling layer). The feature vector output by this layer has high abstractness and discrimination, which is suitable for subsequent analysis tasks.

[0110] The training process of the deep learning model is as follows:

[0111] Collect a large amount of medical imaging data, including X-rays, CT scans, and MRI images, and ensure that the data covers a variety of disease types. Have professional medical personnel perform annotations to ensure the accuracy and consistency of the annotations. The annotation information includes disease type, symptom location, etc. Data preprocessing, including image cropping, scaling, normalization, etc., ensures that the input data meets the model requirements.

[0112] Load the ResNet model weights pre-trained on a large-scale natural image dataset (such as ImageNet) as the initial weights to speed up the training process and improve model performance.

[0113] At the beginning of training, the first few layers of the pre-trained model are frozen. These layers have learned the low-level features of the image and are not easy to change on specific medical imaging data. As training progresses, other layers of the model are gradually unfrozen and fine-tuned using medical imaging datasets to learn feature representations in specific fields.

[0114] The cross-entropy loss function is used as the loss function for the classification task and adjusted according to the task requirements.

[0115] The Adam optimization algorithm is used to update parameters, and an appropriate learning rate decay strategy is set to balance the training speed and model performance. The preprocessed medical imaging data is input into the model, and the forward propagation is performed to calculate the prediction results. The gradient is calculated and the model parameters are updated through the back propagation algorithm. The model performance is regularly evaluated on the validation set, and the hyperparameters (such as learning rate, batch size, etc.) are adjusted according to the validation results. Data enhancement (such as random cropping, rotation, flipping, etc.) and regularization techniques are used to prevent overfitting.

[0116] After the training is completed, the preprocessed medical images are input into the trained model, and the forward propagation process is performed to extract the feature representation of the medical image from a specific layer (such as the penultimate layer of ResNet-50) as the feature descriptor of the image for subsequent analysis or classification tasks.

[0117] Below is a simplified Python code example for building and training a deep neural network model:

[0118] import torch

[0119] import torch.nn as nn

[0120] import torch.optim as optim

[0121]

[0122] val_loader = DataLoader (val_dataset, batch_size = batch_size, shuffle = False) # Verify data loader

[0123] #Load the pre-trained ResNet-50 model

[0124] model=models.resnet50(pretrained=True)

[0125] #Replace the last fully connected layer to match the new number of categories

[0126] num_ftrs = model.fc.in_features # Get the number of fully connected layer input features

[0127] model.fc = nn.Linear(num_ftrs, num_classes) #Replace with a new fully connected layer

[0128] #Set up the device

[0129] device=torch.device("cuda:0"if torch.cuda.is_available()else"cpu")#Use GPU or CPU

[0130] model = model.to(device) #Move the model to the specified device

[0131] #Define loss function and optimizer

[0132] criterion = nn.CrossEntropyLoss()#Cross entropy loss function

[0133] optimizer=optim.Adam(model.parameters(),lr=learning_rate)#Adam optimizer

[0134] #Train model

[0135] for epoch in range(num_epochs):

[0136] model.train()#Set the model to training mode

[0137] running_loss = 0.0 # Initialize the loss accumulator

[0138] for inputs,labels in train_loader:#Traverse the training data

[0139] inputs = inputs.to(device) # Move input to device

[0140] labels = labels.to(device) #Move labels to the device

[0141] optimizer.zero_grad()#clear gradient

[0142] outputs = model (inputs) # forward propagation

[0143] loss=criterion(outputs,labels)#Calculate loss

[0144] loss.backward()#Backward propagation

[0145] optimizer.step()#Update parameters

[0146] running_loss+=loss.item()#Accumulate loss

[0147] #Print training loss

[0148] print(f'Epoch{epoch+1} / {num_epochs},Loss:{running_loss / len(train_loader)}')

[0149] #Evaluate the model on the validation set

[0150] model.eval()#Set the model to evaluation mode

[0151] val_loss = 0.0 # Initialize the validation loss accumulator

[0152] val_correct=0#Initialize correct prediction count

[0153] with torch.no_grad():#Turn off gradient calculation

[0154] for inputs,labels in val_loader:#Traverse verification data

[0155] inputs = inputs.to(device) # Move input to device

[0156] labels = labels.to(device) #Move labels to the device

[0157] outputs = model (inputs) # forward propagation

[0158] loss=criterion(outputs,labels)#Calculate loss

[0159] val_loss+=loss.item()#Accumulate loss

[0160] _,preds=torch.max(outputs,1)#Get prediction results

[0161] val_correct += torch.sum(preds == labels.data) # Calculate the number of correct predictions

[0162] #Calculate validation loss and accuracy

[0163] val_loss / = len(val_loader)

[0164] val_accuracy=val_correct.double() / len(val_dataset)

[0165] #Print validation loss and accuracy

[0166] print(f'Validation Loss:{val_loss},Accuracy:{val_accuracy}')

[0167] #Save model

[0168] torch.save(model.state_dict(),

[0169] 'trained_medical_image_model.pth')#Save model weights

[0170] In the above code, torch is the core package of the PyTorch library, which provides tensor (multidimensional array) data structures and a series of functions for operating these tensors. It is the basis for deep learning research and development; torch.nn contains all the components required to build neural networks, such as layers, activation functions, and loss functions, and provides tools for building and training deep learning models; torch.optim provides various optimization algorithms for updating the weights of the model to minimize the loss function. Common optimization algorithms include SGD, Adam, etc.; torchvision is a PyTorch toolkit for processing images and videos. It provides commonly used data sets, model architectures, and image transformation tools; torchvision.models is a module in the torchvision package, which provides pre-trained model architectures, such as ResNet, VGG, etc. These models can be used as feature extractors.

[0171] Embodiment 4:

[0172] The method of constructing an image similarity graph using an image database is as follows:

[0173] S1: Traverse all medical images in the image database and calculate the similarity between feature descriptors

[0174] a. Initialization process: First, the system traverses the image database, which stores the feature descriptors, storage locations, and metadata of medical images.

[0175] b. Feature descriptor extraction: For each pair of medical images in the database, the system uses deep learning feature extraction methods to extract their feature descriptors, which can quantify the key features of medical images and provide a basis for subsequent similarity calculations.

[0176] c. Similarity calculation: After extracting the feature descriptors, the system calculates the similarity between the feature descriptors of each pair of medical images. The system can quantify the degree of similarity between medical images.

[0177] S2: Constructing image similarity graph

[0178] a. Node pair generation: Each pair of medical images and the similarity between them is regarded as a node pair in the graph. In this graph, the nodes represent medical images, and the connection weight between the node pairs is the similarity value of the pair of medical images. In this way, the system can represent the similarity relationship between medical images as a graph structure.

[0179] b. Graph data storage: Considering that the image database may be very large, the generated image similarity graph will also be very sparse. Therefore, the system uses a sparse matrix data structure to store the image similarity graph. Sparse matrices can store only non-zero elements and their positions, thereby greatly reducing the storage space requirements.

[0180] S3: Use sparse matrix to store image similarity graph

[0181] In order to efficiently store and manage the image similarity graph, the system uses a sparse matrix data structure. The sparse matrix can only store the non-zero elements in the graph (i.e., the similarity between medical images) and their location information, thereby avoiding the storage and processing of a large number of zero values, which not only saves storage space but also improves the query efficiency of the similarity graph.

[0182] S4: Pre-build KD tree spatial index structure

[0183] In order to improve the query efficiency of the image similarity graph, the system uses the KD tree spatial index structure to pre-index the image similarity graph. The KD tree is a data structure used to organize points in a k-dimensional space, which allows for fast and efficient searches of the k-dimensional space. In this context, the system can use the feature descriptors of medical images as points in the k-dimensional space and index these points through the KD tree. In the subsequent query process, the system can quickly retrieve medical images that are similar to the query conditions.

[0184] When a new medical image is added to the image database, the similarity between the new image and the existing images in the database is recalculated and the image similarity graph is updated.

[0185] Embodiment 5:

[0186] In the preprocessing of the uploaded image, the present invention adopts a specific image grayscale method, and the specific implementation steps of the method are as follows:

[0187] S1: Select the weighted method to convert the color image to grayscale image

[0188] First, the present invention selects the weighted method as a method for converting color images into grayscale images. This method uses a specific formula to calculate the grayscale value of each pixel. The specific formula is: GRAY = 0.3R + 0.59G + 0.11*B, where R, G, and B represent the components of the pixel in the red, green, and blue color domains, respectively. This formula takes into account the sensitivity of the human eye to different colors and can generate a grayscale image that is more in line with human eye perception.

[0189] S2: Read medical imaging data and traverse pixel points

[0190] Next, the system reads the image data of the medical image and traverses each pixel in the image. In this process, the system obtains the RGB color value corresponding to each pixel, and uses the RGB color value as the basis for subsequent grayscale conversion.

[0191] S3: Apply the color value conversion method to calculate the grayscale value

[0192] After obtaining the RGB color value of each pixel, the system applies a color value conversion method. Specifically, the system calls the formula GRAY=0.3R+0.59G+0.11*B in step S1 to convert the RGB color value of each pixel obtained in step S2 to obtain the corresponding grayscale value.

[0193] S4: Generate grayscale images of medical images

[0194] Finally, the system applies the converted grayscale value to each pixel to generate a grayscale image of the medical image.

[0195] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.

[0196] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A method for automatic classification and retrieval of data based on image recognition in cloud storage, characterized in that: The method comprises: Building an image database on a cloud storage platform, wherein the image database stores data including feature descriptors, storage locations, and metadata of medical images, for supporting case data retrieval in medical research and teaching; Use the image database to build an image similarity graph and represent the similarity relationship between medical images as a graph structure; The user uploads the medical image to be queried through the client or web interface of the cloud storage service, and the image is input into the retrieval system as a query condition; Preprocess uploaded medical images, including grayscale conversion, enhancing low-resolution images using super-resolution reconstruction techniques, and processing high-dynamic-range images using dynamic range compression algorithms; Use deep learning feature extraction methods to extract features from preprocessed medical images and obtain feature descriptors of the images; Set a similarity threshold, retrieve images whose similarity meets the preset threshold from the image similarity graph through feature descriptors, and sort the retrieval results according to the similarity score; in the calculation of the similarity score, introduce a time decay factor to give a higher weight to newly uploaded medical images; According to the storage location information of each image in the search results, the corresponding medical imaging data is obtained; All acquired medical imaging data and the corresponding metadata are collected as the final result and displayed to the user in the form of a list or grid.

2. The method for automatic data classification and retrieval based on image recognition in cloud storage according to claim 1, characterized in that: The image similarity graph uses medical images as nodes and the similarity between images as edge weights. The similarity is obtained by calculating the distance between image feature descriptors, and the calculation method includes using Euclidean distance or cosine similarity algorithm.

3. The method for automatic data classification and retrieval based on image recognition in cloud storage according to claim 2, characterized in that: The time decay factor is determined by the difference between the image upload time and the current time. The smaller the difference, the higher the weight. The weight calculation uses an exponential decay function, and the formula is: Time decay weight = e -λ(当前时间-上传时间) Among them, λ is the decay coefficient, which is used to control the speed of time decay. The final similarity score of each medical image is calculated by combining the similarity and the time decay weight. The final similarity score is obtained by calculating the product of the similarity and the time decay weight: the final similarity score = similarity × time decay weight.

4. The method for automatic data classification and retrieval based on image recognition in cloud storage according to claim 3, characterized in that: The steps to enhance low-resolution images using super-resolution reconstruction techniques include: Step 1: Represent the uploaded low-resolution medical image as a vector y∈R n , where n is the dimension of the image after vectorization; Step 2: Construct the observation matrix H∈R m×n , used to simulate the degradation factors in the image acquisition process; the observation matrix is ​​further decomposed into the sampling matrix D, the fuzzy matrix B and the motion matrix M, that is, H = DBM, where m represents the dimension of the high-resolution image after vectorization; Step 3: Based on the known low-resolution image y and observation matrix H, solve the high-resolution image x, and the solution equation is: y = Hx.

5. The method for automatic data classification and retrieval based on image recognition in cloud storage according to claim 4, characterized in that: The steps of processing high dynamic range images using dynamic range compression algorithms include: Step 1: Use a fast bidirectional filter to perform logarithmic domain decomposition on the uploaded high dynamic range medical image to decompose it into a basic layer and a detail layer; Step 2: Perform a global brightness mapping algorithm on the base layer to compress the mapping slope of high brightness values ​​and expand the mapping range of intermediate brightness values; the specific formula is: L output =a·log base (L input +b)+c Among them, L input Indicates the input brightness value, L output Represents the output brightness value, a, b, c are constants used to adjust the slope and range of the mapping, base is the logarithmic base, and the value is 2 or 10; Step 3: Process the detail layer using a local tone mapping algorithm, including using a mapping function to obtain a new output value for each pixel in the image; Step 4: Merge the processed basic layer with the detail layer to generate a medical image with dynamic range compression.

6. The method for automatic data classification and retrieval based on image recognition in cloud storage according to claim 5, characterized in that: A deep learning model is selected as a feature extractor. The model is pre-trained on a large medical image dataset and is used to extract representative and discriminative features from the medical images. The pre-processed medical images are input into the selected deep learning model to perform a forward propagation process. A feature representation of the medical image is extracted from a specific layer of the deep learning model, and the feature representation is used as a feature descriptor of the image.

7. The method for automatic data classification and retrieval based on image recognition in cloud storage according to claim 1, characterized in that: The method of constructing an image similarity graph using an image database is: S1: Traverse all medical images in the image database, and for each pair of medical images, perform the following operations: i) extracting feature descriptors for each pair of medical images; ii) calculating the similarity between the feature descriptors of the pair of medical images; S2: Each pair of medical images and the similarity between them is regarded as a node pair in the graph, and the connection weight between the node pairs is the similarity of the pair of medical images; S3: Use sparse matrix data structure to store image similarity graph; S4: Use the KD tree spatial index structure to pre-index the image similarity graph.

8. The method for automatic data classification and retrieval based on image recognition in cloud storage according to claim 1, characterized in that: When a new medical image is added to the image database, the similarity between the new image and the existing images in the database is recalculated and the image similarity graph is updated.

9. The method for automatic data classification and retrieval based on image recognition in cloud storage according to claim 1, characterized in that: In the preprocessing of uploaded medical images, the method of graying the image is: S1. Select the weighted method to convert the color image into a grayscale image, and use the formula GRAY = 0.3*R + 0.59*G + 0.11*B to calculate the grayscale value. R, G, and B in the formula represent the components of the pixel in the red, green, and blue color domains respectively. S2, read the medical image data, traverse each pixel in the image, and obtain the RGB color value corresponding to each pixel; S3, applying a color value conversion method, calling the formula in step S1 to convert the RGB color value of each pixel obtained in step S2, and obtaining a corresponding grayscale value; S4. Apply the converted grayscale value to each pixel to generate a medical image grayscale image.

Citation Information

Patent Citations

  • Large-scale medical image retrieval method based on random sparse codes

    CN103678551A

  • Real-time microblog search method and device

    CN103885985A

  • Medical CT image storage and retrieval method based on random forest hash

    CN109166615A

  • Lung CT image filling method adopting super-resolution reconstruction mode

    CN113658048A

  • Silicon portable charger case

    KR1020210055224A

Cited By

  • Security camera community relation analysis method, device and system based on minimum entropy

    CN120259984A