Cage position cage box intelligent identification method, storage medium and electronic equipment

By improving the YOLOv8 detection model and combining feature fusion pyramid and QR code preprocessing, the problem of time-consuming and labor-intensive cage space and cage box identification has been solved, achieving efficient and accurate cage space and cage box management.

CN122116325APending Publication Date: 2026-05-29SHANGHAI JIAOTONG UNIV SCHOOL OF MEDICINE

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHANGHAI JIAOTONG UNIV SCHOOL OF MEDICINE
Filing Date
2024-11-27
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Traditional methods for identifying cage locations and boxes in laboratory animal management are time-consuming and labor-intensive. Furthermore, manual scanning can easily disturb the animals, leading to uncertain locations and affecting management efficiency and data accuracy.

Method used

An improved YOLOv8 detection model is adopted, which combines RepVGG Block and advanced screening feature fusion pyramid to perform intelligent identification of cage positions and cage boxes. Image enhancement processing and QR code preprocessing are used to improve detection accuracy and speed.

Benefits of technology

It achieves high-precision and rapid cage space and cage box identification, reduces detection time, improves management efficiency, and ensures data accuracy and animal welfare.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122116325A_ABST
    Figure CN122116325A_ABST
Patent Text Reader

Abstract

The application provides a cage position and cage box intelligent identification method, a storage medium and an electronic device. The method comprises the following steps: inputting a picture of a cage frame into a pre-trained YOLOv8 detection model, obtaining a plurality of target images in the picture of the cage frame and pixel coordinates of each target image, and saving each target image according to a category of each target image; the category of each target image comprises an empty cage position, an empty cage box and cage card information; when the total number of cage positions is equal to the actual total number of cage frames, obtaining a target image corresponding to the cage card information and a pixel coordinate of the target image corresponding to the cage card information; and outputting each cage position information of the cage frame based on the obtained target image corresponding to the cage card information and the pixel coordinate of the target image corresponding to the cage card information. The cage position and cage box intelligent identification method provided by the application has the advantages of high detection precision, fast detection speed and high detection accuracy, can batch detect and identify cage positions and cage boxes, and effectively improves the management level of an animal experiment center.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and in particular to the field of intelligent control technology for cages and boxes in animal husbandry. Background Technology

[0002] Laboratory animals play a crucial role in scientific research. Different animal models allow for a deeper understanding of disease mechanisms, drug effects, and treatment methods, thereby accelerating clinical translation. Furthermore, laboratory animals are key tools in neuroscience, pharmacology, and other fields for exploring biological functions and disease pathologies, helping researchers comprehensively understand complex organisms and driving the rapid development of biomedicine. In the management of laboratory animals, proper husbandry and management are prerequisites for the scientific and efficient use of animals and ensuring the quality of scientific research. Reasonable husbandry conditions, appropriate environmental parameters, and standardized operating procedures can significantly reduce human error, decrease abnormal animal mortality, and increase experimental success rates. They also ensure the scientific validity of experimental data, the ethical integrity of the experimental process, and the safety of personnel, facilitating the smooth progress of scientific research. However, with the expansion of laboratory animal facilities, traditional management methods are insufficient to meet the needs of modern scientific research. The construction of an information management system for laboratory animals has become inevitable. Through real-time data collection, processing, and analysis, it can not only ensure the accuracy and traceability of experimental data but also achieve resource sharing and optimized resource allocation by strengthening the management of laboratory animals throughout their entire life cycle, while simultaneously ensuring biosafety and animal welfare. In laboratory animal management systems, QR codes serve as data carriers, affixed to cage tags to identify corresponding cages, ensuring the rapid and accurate recording and tracking of animal information. The precise location of laboratory animals housed in the feeding room requires the caretaker to scan all cages and update the system with cage location information and animal status in a timely manner. This is crucial for ensuring the accuracy of data retrieval for the research team and management personnel in real time. Since each room housing laboratory animals has multiple cage racks, cages are frequently removed by researchers for experiments and not always returned to their original positions, leading to uncertainty in cage location. Manually scanning each cage individually is time-consuming and labor-intensive, and may also disturb the animals' rest, becoming a non-experimental intervention factor. Therefore, there is an urgent need to develop an algorithm for batch detection and identification of cage locations and cages, enabling visualization of laboratory animal locations and information, and improving management efficiency.

[0003] In recent years, deep learning has been widely researched and applied in various fields such as image recognition and processing due to its powerful feature extraction and generalization capabilities. This provides a new approach for intelligent identification of cage positions and cage boxes. Although there are no mature algorithms for batch identification of cage positions and cage boxes both domestically and internationally, relatively mature algorithms for QR code detection and recognition can be referenced. For example, the single-shot target detector architecture SSD is improved using pyramid pooling networks to detect QR codes; Faster-RCNN based on FPN is used for QR code detection in complex scenes; improving YOLOv3 by adding an SPP structure can improve the accuracy of QR code detection; and batch localization and recognition of QR codes in complex backgrounds can be achieved by improving the network structure of YOLOv4 and optimizing the prior box size. Intelligent identification of cage positions and cage boxes in experimental animal management systems not only needs to recognize cage tag QR codes in complex backgrounds, but also needs to determine the position of cage boxes and cage positions. The updating of cage information will affect the accuracy and timeliness of data in the feeding and management process, so higher requirements are placed on the accuracy and speed of intelligent identification.

[0004] Application content

[0005] In view of the shortcomings of the prior art described above, the purpose of this application is to provide a method, storage medium and electronic device for intelligent identification of cage positions and boxes, for batch detection and identification of cage positions and boxes, and to effectively improve the management level of animal experimental centers.

[0006] To achieve the above and other related objectives, this application provides a method for intelligent recognition of cage positions and cage boxes. The method includes: acquiring an image of a cage rack; inputting the image of the cage rack into a pre-trained YOLOv8 detection model to acquire multiple target images and pixel coordinates of each target image in the image of the cage rack, and saving each target image and its corresponding pixel coordinates according to the category of each target image; the categories of the target images include empty cage positions, empty cage boxes, and cage tag information; traversing the multiple target images to obtain the total number of cage positions, and when the total number of cage positions is equal to the actual total number of cage positions on the cage rack, acquiring the target image corresponding to the cage tag information and its pixel coordinates; and outputting and displaying the cage position information of the cage rack based on the acquired target image corresponding to the cage tag information and its pixel coordinates.

[0007] In one embodiment of this application, obtaining the image of the cage frame includes: obtaining at least two photographed images of the cage frame; performing enhancement processing on the photographed images of the cage frame, wherein the enhancement method is one or more combinations of mosaic enhancement, hybrid enhancement, spatial perturbation, and color perturbation; and stitching the enhanced photographed images of each cage frame into one image of the cage frame.

[0008] In one embodiment of this application, inputting the image of the cage frame into a pre-trained YOLOv8 detection model to obtain multiple target images and pixel coordinates of each target image includes: the YOLOv8 detection model performing target detection on the input image of the cage frame and obtaining the prediction bounding box of each target image, the category of the cage position / cage box predicted by each prediction bounding box, and pixel coordinates; cropping the targets detected from the image of the cage frame to form each target image, and saving each target image and pixel coordinates to an empty cage position folder, an empty cage box folder, and a cage tag information folder based on the category of the cage position / cage box predicted by each prediction bounding box.

[0009] In one embodiment of this application, when the cage information includes QR code information, the target detection of the input image of the cage includes: enlarging the QR code image and normalizing the size of the QR code image according to the input standard conforming to the Zbar algorithm; in response to the inability to recognize the QR code in the QR code image, alternatingly using one of the following methods to adjust the QR code image: highlighting image details, edge enhancement, grayscale, increasing sharpness, and increasing contrast.

[0010] In one embodiment of this application, the YOLOv8 detection model includes an input module, a backbone network module, a neck network module, a head network module, and a RepVGG Block module. The cage image is processed by the input module and then enters the backbone network module. The RepVGG Block module is used to obtain target image features of three different scales in the cage dataset by using convolutional kernels of different sizes during the training of the YOLOv8 detection model. The backbone network module includes Conv convolutional layers, a C2f module, and an SPPF module, which are used to extract image features from the input cage image to form feature sets of different categories of images. The feature pyramid structure in the neck network module fuses the semantic and positional information of the cage positions and boxes through upsampling and downsampling. The head network module outputs the predicted bounding boxes of each target image, the category of the cage position and box predicted by each predicted bounding box, and the pixel coordinates of the predicted cage position and box in an anchorless manner.

[0011] In one embodiment of this application, the YOLOv8 detection model uses the DFL loss function to calculate the regression value corresponding to each prediction box in a probabilistic manner.

[0012] In one embodiment of this application, the feature pyramid structure in the neck network module is configured with a channel attention module. The channel attention module uses high-level semantic features as weights to filter low-level features, and then adds and fuses the filtered features with high-level semantic features point by point to generate a feature map rich in semantic details.

[0013] In one embodiment of this application, the YOLOv8 detection model expands the training dataset during training by any one or a combination of methods such as blurring, vertical flipping, rotation, mesh distortion, affine transformation, and saturation adjustment.

[0014] To achieve the above and other related objectives, this application also provides a computer storage medium storing program instructions, which, when executed, implement the steps of the intelligent identification method for cage positions and cage boxes as described above.

[0015] To achieve the above and other related objectives, this application also provides an electronic device, including a memory for storing a computer program and a processor for running the computer program to implement the steps of the intelligent identification method for cage positions and cage boxes as described above.

[0016] As described above, the intelligent identification method, storage medium, and electronic device of this application have the following beneficial effects:

[0017] The intelligent cage space and cage box recognition method provided in this application has the advantages of high detection accuracy, fast detection speed and high detection precision. It can detect and identify cage spaces and cage boxes in batches, effectively improving the management level of animal experimental centers. Attached Figure Description

[0018] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 This is a schematic diagram of the overall process of the intelligent identification method for cage positions and cage boxes in one embodiment of this application.

[0020] Figure 2 The diagram shown is a schematic diagram illustrating the principle of obtaining images of cage frames in the intelligent identification method for cage positions and cage boxes according to an embodiment of this application.

[0021] Figure 3 The image shown is a schematic diagram of a cage frame in a cage position and cage box intelligent recognition method according to an embodiment of this application.

[0022] Figure 4 The diagram shows a schematic of the YOLOv8 network structure in the intelligent identification method for cage positions and cage boxes in one embodiment of this application.

[0023] Figure 5 The diagram shown is a schematic representation of text information in a cage position and cage box intelligent recognition method according to an embodiment of this application.

[0024] Figure 6a The diagram shown is a schematic diagram of an empty cage slot folder in a cage slot and cage box intelligent identification method according to an embodiment of this application.

[0025] Figure 6b The diagram shown is a schematic diagram of an empty cage box folder in a cage position and cage box intelligent identification method according to an embodiment of this application.

[0026] Figure 6c The diagram shown is a schematic diagram of the cage tag QR code folder in the cage position and cage box intelligent recognition method in one embodiment of this application.

[0027] Figure 7 The diagram shown is an improved YOLOv8 network structure diagram in the intelligent identification method for cage positions and cage boxes in one embodiment of this application.

[0028] Figure 8 The diagram shows the RepVGGBlock module structure during the training phase of the intelligent cage position and cage box recognition method in one embodiment of this application.

[0029] Figure 9 The diagram shown is an HS-FPN structure diagram in the intelligent identification method for cage positions and boxes according to an embodiment of this application.

[0030] Figures 10a to 10e The diagram shown is a schematic diagram of the preprocessing of the cage tag QR code in the intelligent identification method of cage position and cage box in one embodiment of this application.

[0031] Figure 11 The diagram shows the implementation principle of the intelligent identification method for cage positions and cage boxes in one embodiment of this application.

[0032] Figure 12 This illustrates the effect of magnification on the number of cages identified in a cage position and cage box intelligent identification method according to an embodiment of this application.

[0033] Figure 13 The diagram shown is a schematic block diagram of an electronic device according to an embodiment of this application. Detailed Implementation

[0034] The following specific examples illustrate the implementation of this embodiment. Those skilled in the art can easily understand other advantages and effects of this embodiment from the content disclosed in this specification. This embodiment can also be implemented or applied through other different specific implementation methods, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this embodiment. It should be noted that, in the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0035] This embodiment provides a method, storage medium, and electronic device for intelligent identification of cage spaces and cage boxes, which can be used for batch detection and identification of cage spaces and cage boxes, effectively improving the management level of animal experimental centers.

[0036] To address the time-consuming and labor-intensive nature of traditional methods in laboratory animal husbandry and management, this embodiment provides an intelligent cage identification method. In this embodiment, firstly, an improved YOLOv8 algorithm is used to detect cage locations in photographs: the ordinary convolutions in the backbone network are replaced with RepVGG blocks to improve the model's feature extraction capabilities; an advanced filtering feature fusion pyramid is added to focus on feature details at different scales. Secondly, a magnification and focusing method is used to preprocess the images to achieve a higher recognition rate. The algorithm is tested and evaluated using photographs of cages taken at a university's laboratory animal center. The results show that compared to the original YOLOv8, the improved model reduces detection time by 25.72% in practical applications, achieving a detection accuracy of 99.48%, demonstrating higher accuracy and speed. Furthermore, by adjusting the photographs of the cages, the final recognition rate can reach 95.05%, and the recognition time is approximately one-thirtieth of that required by traditional methods, significantly improving the efficiency of animal keepers.

[0037] The following will describe in detail the principles and implementation methods of the intelligent identification method, storage medium, and electronic equipment for cage positions and boxes in this embodiment, so that those skilled in the art can understand the intelligent identification method, storage medium, and electronic equipment for cage positions and boxes in this embodiment without creative effort.

[0038] In experimental animal management systems, intelligent identification of cage positions and cage boxes is mainly applied in the feeding and processing module. By recognizing photos of cage racks, the system can update cage position and cage box information in real time, facilitating the research team and administrators to retrieve accurate data. To complete the scanning work more accurately and quickly, it is necessary to detect all cage positions in the entire cage rack and obtain the location of the corresponding cage box and the cage tag QR code information. Therefore, by combining the target detection model with the open-source QR code recognition library ZBar, a batch detection and recognition algorithm for cage positions and cage boxes is proposed.

[0039] Specifically, this application provides a method for intelligent identification of cage positions and cage boxes. Figure 1 This is a schematic diagram illustrating the overall process of a cage location and cage box intelligent identification method in one embodiment of this application; as shown below. Figure 1 As shown, the method includes the following steps S100 to S200.

[0040] Step S100: Obtain an image of the cage frame;

[0041] Step S200: Input the image of the cage frame into the pre-trained YOLOv8 detection model to obtain multiple target images and the pixel coordinates of each target image in the image of the cage frame, and save each target image and its corresponding pixel coordinates according to the category of each target image; the category of the target image includes empty cage position, empty cage box and cage tag information;

[0042] Step S300: Traverse the multiple target images to obtain the total number of cage positions, and when the total number of cage positions is equal to the actual total number of dragon positions in the cage frame, obtain the target image corresponding to the cage sign information and the pixel coordinates of the target image corresponding to the cage sign information.

[0043] Step S400: Based on the target image corresponding to the acquired cage tag information and the pixel coordinates of the target image corresponding to the cage tag information, output and display the cage position information of each cage position on the cage frame.

[0044] The following provides a detailed description of steps S100 and S400 in the intelligent identification method for cage positions and boxes in this embodiment.

[0045] Step S100: Obtain an image of the cage frame.

[0046] Figure 2 The diagram shown illustrates the principle of acquiring images of cage frames in a cage space and cage box intelligent recognition method according to an embodiment of this application; as follows: Figure 2 As shown, in one implementation of this embodiment, acquiring the image of the cage includes: acquiring at least two images of the cage; enhancing the images of the cage, wherein the enhancement method is one or more combinations of mosaic enhancement, hybrid enhancement, spatial perturbation, and color perturbation; and stitching the enhanced images of each cage into one image of the cage.

[0047] In this embodiment, the zookeeper takes and uploads photos of the laboratory animal cages that need to be identified. Each cage photo is as follows: Figure 3 As shown, the cages are composed of x rows and y columns. The cage position is represented by the top left corner as the origin and its position information can be expressed as (x, y). For example, the cages of common laboratory mice are 9 rows and 8 columns. Thus, the coordinates of the cage positions are (1, 1), (1, 2), ..., (9, 8), with a total of 72 cage positions.

[0048] In this embodiment, four data enhancement methods—mosaic enhancement, hybrid enhancement, spatial perturbation, and color perturbation—are used to stitch the cage images into the model, increasing the number of cage positions and targets in the input and improving its detection capability.

[0049] Step S200: Input the image of the cage frame into the pre-trained YOLOv8 detection model to obtain multiple target images and the pixel coordinates of each target image in the image of the cage frame, and save each target image and its corresponding pixel coordinates according to the category of each target image; the category of the target image includes empty cage position, empty cage box and cage tag information.

[0050] Step S300: Traverse the multiple target images to obtain the total number of cage positions, and when the total number of cage positions is equal to the actual total number of dragon positions on the cage rack, obtain the target image corresponding to the cage tag information and the pixel coordinates of the target image corresponding to the cage tag information.

[0051] Step S400: Based on the target image corresponding to the acquired cage tag information and the pixel coordinates of the target image corresponding to the cage tag information, output and display the cage position information of each cage position on the cage frame.

[0052] In one implementation of this embodiment, the image of the cage rack is input into a pre-trained YOLOv8 detection model to obtain multiple target images and pixel coordinates of each target image. This includes: the YOLOv8 detection model performing target detection on the input image of the cage rack and obtaining the prediction bounding box of each target image, the category of the cage position / cage box predicted by each prediction bounding box, and the pixel coordinates; cropping the targets detected from the image of the cage rack to form each target image, and saving each target image and pixel coordinates to an empty cage position folder, an empty cage box folder, and a cage tag information folder based on the category of the cage position / cage box predicted by each prediction bounding box.

[0053] YOLOv8 can accurately and quickly detect three types of target objects: empty cage positions, empty cage boxes, and cage tag QR codes. It also draws bounding boxes for each detected object, laying the foundation for subsequent batch recognition of cage tags. YOLOv8 consists of an input network, a backbone network, a neck network, and a head network. Figure 4 As shown.

[0054] In other words, in one implementation of this embodiment, the YOLOv8 detection model includes an input module, a backbone network module, a neck network module, a head network module, and a RepVGG Block module. The cage image is processed by the input module and then enters the backbone network module. The RepVGG Block module is used to obtain the target image features of three different scales in the cage dataset by using convolutional kernels of different sizes during the training of the YOLOv8 detection model. The backbone network module includes Conv convolutional layers, a C2f module, and an SPPF module, which are used to extract image features from the input cage image to form feature sets of different categories of images. The feature pyramid structure in the neck network module fuses the semantic and positional information of the cage positions and boxes through upsampling and downsampling. The head network module outputs the predicted bounding boxes of each target image, the category of the cage position and box predicted by each predicted bounding box, and the pixel coordinates of the predicted bounding boxes in an anchorless manner.

[0055] In one implementation of this embodiment, the YOLOv8 detection model uses the DFL loss function to calculate the regression value corresponding to each prediction box in a probabilistic manner.

[0056] Specifically, such as Figure 4 As shown, the backbone network in this embodiment consists of Conv convolutional layers, a C2f module, and an SPPF module. The input cage image undergoes feature extraction within the backbone network, forming feature sets for different image categories. The Conv convolutional layers use 3×3 convolutional kernels with a stride of 2 to initially extract features; the C2f module enhances the richness of the gradient flow while maintaining lightweight design through more shortcut connections; and the SPPF module achieves the fusion of local and global features through multiple max-pooling operations.

[0057] In this embodiment, the neck network fuses the semantic and positional information of the cage positions and boxes through upsampling and downsampling to ensure accurate prediction of cage images. The decoupled head structure uses two parallel branches to extract category and positional features respectively, thereby enhancing detection performance. To address the potential class imbalance issue in the input cage images, the DFL (Dynamic Freezing Loss) loss function is used during model training to calculate the regression value corresponding to each predicted box probabilistically. Simultaneously, the head network also employs an anchor-free strategy, directly predicting the center of the target object instead of predicting offsets from predefined anchor boxes, thus reducing model complexity.

[0058] In one implementation of this embodiment, the feature pyramid structure in the neck network module is configured with a channel attention module. The channel attention module uses high-level semantic features as weights to filter low-level features, and then adds and fuses the filtered features with the high-level semantic features point by point to generate a feature map rich in semantic details.

[0059] In this embodiment, the YOLOv8 detection model is used to detect the cage frame photos and obtain predicted bounding boxes, outputting three folders, such as... Figure 5 , Figures 6a to 6c As shown, the type and location information of the cage space and cage box predicted by each prediction box are saved as text information, and the detected targets are cropped and saved to the empty cage space, empty cage box and cage sign QR code folders respectively.

[0060] YOLOv8 is a cutting-edge technology in the field of target detection, balancing detection accuracy and speed. However, in cage and cage identification algorithms, the detection accuracy of cage images affects the number of times the same cage can be photographed, thus impacting the accuracy and update speed of system information. To improve the efficiency of zookeepers, YOLOv8 needs further improvement to achieve higher detection accuracy and faster detection speed. The improved network structure is as follows: Figure 7 As shown.

[0061] This embodiment introduces the RepVGG Block module into the YOLOv8 network structure, using structural reparameterization technology to decouple the training and inference phases, thereby optimizing network performance at different stages and improving network flexibility and detection speed. During the inference phase, single-path 3x3 convolutional kernels are used for computation, similar to the original network. However, during the training phase, some convolutions in the backbone network are replaced with multi-branch structures, such as... Figure 8 As shown, convolution kernels of different sizes are used to obtain the features of target images of three different scales in the cage dataset.

[0062] However, the height and width of a single cage position occupy less than one-tenth of the cage frame image, meaning the three target object types are relatively small in size, and the available features are limited. Traditional convolutional operations may struggle to capture all their semantic information. To address this issue, multi-branch structures not only extract semantic information from shallower feature maps, but also, as the network deepens, residual connection branches effectively preserve detailed information, thereby enhancing the richness of feature semantics and improving detection accuracy.

[0063] In this embodiment, a RepVGG Block module is introduced into the existing YOLOv8 network structure. The feature pyramid structure in the YOLOv8 neck network acquires high-level features through a uniform-scale upsampling process and adds them to the low-level features obtained through downsampling to enhance local localization information and alleviate the problems caused by the asymmetry of semantic and positional information. However, the features in the cage images are relatively limited and have scale differences. In addition, the size diversity inherent in different shooting distances and target categories increases the difficulty of detecting cage positions and cage boxes.

[0064] To extract feature information more effectively, the Advanced Feature Fusion Pyramid (HS-FPN) is used, such as... Figure 9As shown, a channel attention module is used to filter low-level features by using high-level semantic features as weights. The filtered features are then fused with the high-level semantic features point-by-point to generate a feature map rich in semantic details. This is particularly important for detecting subtle features in cage images, enhancing the network's detection capabilities. Simultaneously, transposed convolution (ConvT) and bilinear interpolation are combined during sampling to restore the high-level feature map to its original scale by manipulating the image pixels, achieving efficient image scaling. The channel attention module combines max pooling and average pooling to extract the most representative information from each channel while minimizing information loss, effectively removing redundant data and thus improving the network's accuracy and computational efficiency.

[0065] Furthermore, in photographs of laboratory animal cages, cage positions, cage boxes, and cage tags are often multiple small targets concentrated in a single image, leading to low recognition rates for the QR codes on the cage tags captured by object detection. Therefore, the individual QR code images are first enlarged to achieve a focusing effect, and the image size is normalized to ensure that the image meets the input criteria of the Zbar algorithm, thereby improving recognition accuracy.

[0066] Typically, the edges of enlarged cage-shaped QR codes appear jagged, making the entire image relatively blurry. To alleviate this, this embodiment uses five methods—enhancing image details, edge strengthening, grayscale conversion, and increasing sharpness and contrast—to adjust the image based on different recognition problems, as shown in Figure 10. If the cage-shaped QR code has been recognized, the image path and corresponding recognition result are saved, and the next adjustment method is not used. Otherwise, the enlarged image that was not recognized is processed using the next method before being recognized. Finally, the cage-shaped image path and its corresponding recognition result are saved; unrecognized images are saved as -1.

[0067] In one implementation of this embodiment, the YOLOv8 detection model expands the training dataset during training by any one or a combination of methods such as blurring, vertical flipping, rotation, mesh distortion, affine transformation, and saturation adjustment.

[0068] Figure 11 The diagram shown illustrates the implementation principle of the intelligent cage location and cage box identification method in one embodiment of this application; as follows: Figure 11 As shown, the zookeepers first take and upload photos of the laboratory animal cages that need to be identified. Each cage photo is as follows: Figure 3As shown, the cages are arranged in x rows and y columns. The cage position, with its top-left corner as the origin, can be represented as (x, y). For example, a common laboratory mouse cage is 9 rows and 8 columns, so the coordinates of the cage positions are (1, 1), (1, 2), ..., (9, 8), for a total of 72 cage positions. Cage boxes are placed irregularly among the cage positions, resulting in empty cage positions when not fully occupied. Laboratory animals are stored in cage boxes, and these cage tags have QR codes. Therefore, the YOLOv8 detection targets are categorized into empty cage positions, empty cage boxes, and cage tag QR codes. Object detection can obtain the category, pixel ordinate, and pixel abscissa of a single target image, and the images are saved in folders corresponding to their respective categories.

[0069] The system iterates through all saved folders to count the images and calculates the total number of detected cage slots. If the total number of cage slots is not equal to 72, it returns and prompts the user to retake the photos. When the total number of cage slots is equal to 72, all images in the cage tag QR code category folder are preprocessed and read using Zbar to obtain the pixel coordinates of all cage frames and detailed information about the cage boxes, laying the groundwork for determining the location coordinates of the cage slots and their recognition results.

[0070] The image paths in the folder are mapped to their corresponding pixel coordinates according to the target category. These pixel coordinates are then sorted in ascending order to obtain the location coordinates of the cage positions / boxes. Simultaneously, the image recognition results are associated with the corresponding location coordinates based on the image paths of the cage tags / QR codes. Empty cage positions and boxes receive no recognition results, with an output of 0, which is displayed as unrecognized on the front-end page. Finally, a JSON file is generated for easy data transmission within the information management system.

[0071] In the experimental animal management system based on the Spring Boot framework, the backend service, through port listening, can respond to POST requests from the Python environment and receive the JSON data carried within. After parsing this JSON data, the system presents the parsed data more intuitively on the front-end user interface through an API interface, thereby providing keepers with an efficient and convenient intelligent recognition and interaction experience for cage positions and boxes.

[0072] The following describes the experimental results of the intelligent identification method for cage positions and cage boxes in this embodiment.

[0073] The experiment in this embodiment was conducted in a PyTorch environment using Python 3.7, with a computer configuration of Intel Core i5-8500 CPU, 16GB of RAM, and NVIDIA GeForce RTX 1080 GPU.

[0074] This embodiment uses a self-built cage dataset for training and testing. Thirty cage photos were taken from randomly selected rooms in a university's experimental animal center, containing between 8 and 72 cage spaces and 6 to 72 cage boxes. To increase the network's robustness, this embodiment expanded the dataset using blurring, vertical flipping, rotation, mesh distortion, affine transformation, and saturation adjustment, ultimately resulting in 200 images. These images were manually labeled using LabelImg as three categories: empty cage spaces, empty cage boxes, and cage tag QR codes. For example, the self-built dataset was randomly divided into training, testing, and validation sets in a 7:2:1 ratio. The training dataset contained 1966 empty cage space targets, 852 empty cage box targets, and 5226 cage tag QR code targets.

[0075] In this embodiment, the intelligent cage location and cage box recognition method uses average detection precision (mAP50) to evaluate detection accuracy, parameter quantity to evaluate model size, and average detection time per image to evaluate algorithm time complexity. The cage tag QR code recognition algorithm uses recognition rate as the primary evaluation indicator, i.e., the proportion of correctly identified QR codes out of the total number of cage tag QR codes in the cage location image; accuracy is secondary, i.e., the proportion of correctly identified three types of target objects in the cage location image out of the total number of targets.

[0076] To evaluate the practical performance of the improved method on the cage location / cage box detection task, this embodiment compares the improved YOLOv8 with the original YOLOv8, using the same dataset, pre-training weights of YOLOv8n.pt, a training batch size of 4, an initial learning rate of 0.01, 500 iterations, and both workers and seeds of 0. The performance comparison between the improved YOLOv8 and the original is shown in Table 1. The RepVGG Block improved the detection accuracy of the original model by 1.1 percentage points with almost no impact on model size or detection time. HS-FPN improved the model accuracy by 1% while reducing the model size by 38.61% and the detection time per image by 7.62%. Finally, the model obtained in this embodiment has a detection accuracy 1.8% higher than the original model, and both time complexity and detection time are reduced, thus improving detection accuracy while accelerating detection speed.

[0077] Table 1. Experimental results of the improved model ablation experiment.

[0078] RepVGGBlock HS-FPN mAP / % Number of parameters / millions Detection time / ms 97.6 3.16 94.5 √ 98.7 3.06 95.5 √ 98.6 1.94 87.3 √ √ 99.4 1.98 87.2

[0079] The object detection algorithms are compared as follows:

[0080] On the same COCO dataset, YOLOv4 performed object detection with higher average detection accuracy than Faster-RCNN, SSD512 and YOLOv3

[17] . Therefore, YOLOv4, YOLOv8 and the improved YOLOv8 were trained on the self-built cage dataset to compare their performance. Their mAP values ​​and average detection times are shown in Table 2. The results show that, compared with YOLOv4, YOLOv8, which adopts the anchor box-less strategy, only improved the average detection accuracy by 1.04%, but improved the detection speed by 34.87%. The improved YOLOv8 has the best performance in both detection accuracy and detection speed.

[0081] Table 2. Comparison of experimental results for different detection algorithms

[0082] algorithm mAP50 / % Average detection time / ms YOLOv4 96.56 145.1 YOLOv8 97.6 94.5 Improved YOLOv8 99.4 87.2

[0083] The recognition algorithms are compared as follows:

[0084] After detecting and segmenting the cage frame photos, the cage tags must be identified to ensure a one-to-one correspondence between cage position information and location coordinates. To compare the effectiveness of the identification algorithms, tests were conducted on two aspects: magnification and the number of cage positions contained in the cage frame image.

[0085] Three photos of cages taken by keepers were randomly selected for comparison of preprocessing methods. Each image was segmented using YOLOv8 to create three target folders. Images in the cage tag QR code folders were compared by magnification. All images were adjusted using five methods: enhancing image details, edge enhancement, grayscale conversion, and increasing sharpness and contrast before recognition. It is assumed that images 1, 2, and 3 contain 63, 54, and 72 QR codes respectively. Figure 12 It can be seen that for different images of experimental animal cages, normalizing the height and width of each cage tag's QR code to different multiples of 224 improved the number of codes the algorithm could ultimately recognize compared to the original image. Specifically, when magnified 4 times (height and width both set to 224×5), the algorithm achieved the best recognition performance compared to other magnification levels. Images 1, 2, and 3 could recognize 57, 54, and 60 codes respectively, with an average recognition rate of 91.23%, which is 10.39% higher than recognizing the original image directly.

[0086] When photographing laboratory animal cages, different shooting distances result in varying numbers of cages and boxes in the photos, leading to different recognition rates. To investigate the impact of different cage numbers, images in the dataset were cropped and divided into five groups based on the number of cages in a single cage image: 1-15, 16-30, 31-45, 46-60, and 61-72. From the cropped dataset, 100 cage images were randomly selected to detect and segment the cage tag QR codes, totaling 1836. The results of batch cage tag recognition were compared with the optimal magnification setting, as shown in Table 3.

[0087] Table 3. Recognition results of cage images in different groups

[0088]

[0089] As shown in Table 3, the preprocessed cage image details were magnified and focused, resulting in a significant improvement in the recognition rate of the cage tag QR codes for all groups compared to direct Zbar reading, with an overall increase of 13.51%. When the number of cage slots in the cage image was less than or equal to 60, the recognition rate remained high after preprocessing. However, when the number of cage slots in a single image exceeded 60, the batch recognition rate decreased significantly regardless of preprocessing. This is because during shooting, factors such as distance and camera shake can cause blurring and distortion of the QR codes on the bottom cage tags, which is a limitation of the algorithm. Future research can improve the algorithm's recognition rate by correcting these special QR codes.

[0090] A room in a university's experimental animal center was selected for an intelligent recognition experiment. The room had eight cages arranged in a 9×8 grid, with 110 empty cages, 47 empty cage boxes, and 419 cage tag QR codes, totaling 576 targets. The weights of a previously trained YOLOv8 and an improved YOLOv8 were used to detect and recognize these eight cage images, as shown in Table 4. In practical applications, compared to the original YOLOv8, the improved YOLOv8 can ignore interference from other cages in the background, more accurately detecting and distinguishing empty cages, empty cage boxes, and cage tag QR codes, achieving an accuracy rate of 99.48%. This reduces the number of retakes due to incorrect cage counts, thus reducing the zookeeper's operation time. Simultaneously, the total time for detecting these eight cage images was reduced by 25.72%, further improving efficiency.

[0091] Table 4. Test results of cage samples

[0092]

[0093] One floor of the experimental animal center has more than ten rooms, each containing 4 to 20 shelves, with each mouse shelf having more than 50 cages. For an experimental animal center with nearly 20,000 cages, manually scanning one cage takes an average of more than 2 seconds, and scanning all cages would take nearly 12 hours, which is too much of a workload for the zookeepers. After applying the intelligent recognition algorithm, each cage only needs to be photographed and uploaded with one to three photos. Taking and uploading a photo of one cage only takes 3 seconds, and the milliseconds of detection and recognition are negligible. This means that updating the cage information for the entire experimental animal center can be completed in just 20 minutes, reducing the recognition time by about 97%. This allows zookeepers to update the data once a day, and administrators and experimental staff can retrieve the correct information in a much shorter time.

[0094] As can be seen from the above, this embodiment addresses the problem of the large workload in updating cage information in experimental animal management systems by proposing an intelligent cage identification algorithm and improving YOLOv8 using RepVGG Block and HS-FPN. First, the YOLOv8 object detection algorithm is improved using RepVGG Block and advanced filtering feature fusion pyramid, increasing the network's detection accuracy and reducing detection time. Second, a dataset is built based on photos of experimental animal cages taken by zookeepers to train the algorithm. After detecting and segmenting the images, the QR code images of individual cage tags are preprocessed to improve the final recognition rate. Experiments show that the improved YOLOv8 combined with the preprocessing method can achieve batch detection and identification of cages, effectively improving the management level of animal experimental centers.

[0095] To verify the effectiveness and practical application value of the algorithm, this embodiment involved photographing cages at a university's experimental animal center, establishing a dataset, and conducting experiments. The results showed that the improved YOLOv8 increased detection accuracy by 1.8% and was faster, achieving a detection accuracy of 99.48% in practical applications and reducing recognition time by 98.89%. Furthermore, preprocessing methods such as magnification and focusing further increased the recognition rate and improved the accuracy of the system data. Future research will involve tilt correction of the cage photos to obtain more accurate position coordinates, reducing the number of retakes by zookeepers, and deblurring and spatial transformation of the cage tag QR codes to improve batch recognition rates, thereby increasing zookeeper efficiency.

[0096] The scope of protection of the intelligent identification method for cage positions and cage boxes described in this application is not limited to the execution order of the steps listed in this embodiment. Any solution implemented by adding, subtracting, or replacing steps in the prior art based on the principles of this application is included within the scope of protection of this application.

[0097] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the intelligent identification method for cage positions and cage boxes provided in any embodiment of this application.

[0098] In the embodiments of this application, any combination of one or more storage media can be used. The storage medium can be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium can be, for example—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, RAM, ROM, erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0099] like Figure 13 As shown in the figure, this application also provides an electronic device. Figure 13 The diagram shown is a structural schematic of the electronic device 100 provided in an embodiment of this application. In some embodiments, the electronic device may be a mobile phone, tablet computer, wearable device, in-vehicle device, augmented reality (AR) / virtual reality (VR) device, laptop computer, ultra-mobile personal computer (UMPC), netbook, personal digital assistant (PDA), or other terminal device. Furthermore, the cage location and cage box intelligent identification method provided in this application can also be applied to databases, servers, and service response systems based on terminal artificial intelligence. This application does not limit the specific application scenarios of the cage location and cage box intelligent identification method.

[0100] like Figure 13 As shown, the electronic device 100 provided in this application embodiment includes a memory 101 and a processor 102.

[0101] The memory 101 is used to store computer programs; preferably, the memory 101 includes various media that can store program code, such as ROM, RAM, magnetic disk, USB flash drive, memory card or optical disk.

[0102] Specifically, memory 101 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) and / or cache memory. Electronic device 100 may further include other removable / non-removable, volatile / non-volatile computer system storage media. Memory 101 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of this application.

[0103] The processor 102 is connected to the memory 101 and is used to execute the computer program stored in the memory 101 so that the electronic device 100 executes the intelligent identification method for cage positions and boxes provided in any embodiment of this application.

[0104] Optionally, the processor 102 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0105] Optionally, in this embodiment, the electronic device 100 may further include a display 103. The display 103 is communicatively connected to the memory 101 and the processor 102, and is used to display the relevant GUI interactive interface of the cage position and cage box intelligent identification method.

[0106] In summary, the intelligent cage / cage box recognition method provided in this application has the advantages of high detection accuracy, fast detection speed, and high detection precision. It can batch detect and identify cage / cage boxes, effectively improving the management level of animal experimental centers. Therefore, this embodiment effectively overcomes the various shortcomings of the prior art and has high industrial application value.

[0107] The above embodiments are merely illustrative of the principles and effects of this embodiment and are not intended to limit this embodiment. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of this embodiment. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in this embodiment should still be covered by the claims of this embodiment.

Claims

1. A method for intelligent identification of cage positions and cage boxes, characterized in that: The method includes: Get an image of the cage frame; The image of the cage is input into a pre-trained YOLOv8 detection model to obtain multiple target images and the pixel coordinates of each target image in the image of the cage. Each target image and its corresponding pixel coordinates are saved according to the category of each target image. The categories of the target images include empty cage positions, empty cage boxes, and cage tag information. The target images are traversed to obtain the total number of cage positions. When the total number of cage positions is equal to the actual total number of dragon positions in the cage frame, the target image corresponding to the cage sign information and the pixel coordinates of the target image corresponding to the cage sign information are obtained. Based on the target image corresponding to the acquired cage tag information and the pixel coordinates of the target image corresponding to the cage tag information, the information of each cage position on the cage rack is output and displayed.

2. The intelligent identification method for cage positions and cage boxes according to claim 1, characterized in that: The acquisition of images of the cage includes: Obtain at least two photos of the cage; The images of the cage are enhanced by one or more of the following methods: mosaic enhancement, hybrid enhancement, spatial perturbation, and color perturbation. The enhanced images of each cage are stitched together to form a single image of the cage.

3. The intelligent identification method for cage positions and cage boxes according to claim 1, characterized in that: The image of the cage is input into a pre-trained YOLOv8 detection model to obtain multiple target images and the pixel coordinates of each target image from the image of the cage, including: The YOLOv8 detection model performs target detection on the input image of the cage frame and obtains the predicted bounding box of each target image, the category of the cage position and the pixel coordinates predicted by each predicted bounding box; The targets detected from the images of the cage frame are cropped to form target images. Based on the category of the cage position and cage box predicted by each prediction box, the target images and pixel coordinates are saved to the empty cage position folder, the empty cage box folder, and the cage sign information folder, respectively.

4. The intelligent identification method for cage positions and cage boxes according to claim 2 or 3, characterized in that: When the cage tag information includes QR code information, the target detection process for the input image of the cage includes: The QR code image is enlarged and its size is normalized according to the input standard conforming to the Zbar algorithm. In response to the inability to recognize the QR code in the QR code image, the QR code image is adjusted by alternating between one of the following methods: highlighting image details, edge enhancement, grayscale conversion, increasing sharpness, and increasing contrast.

5. The intelligent identification method for cage positions and cage boxes according to claim 1 or 3, characterized in that: The YOLOv8 detection model includes an input module, a backbone network module, a neck network module, a head network module, and a RepVGG Block module. The image of the cage is processed by the input module and then sent to the backbone network module; The RepVGG Block module is used to obtain target image features of three different scales in the cage dataset by using convolution kernels of different sizes during the training of the YOLOv8 detection model. The backbone network module includes Conv convolutional layers, C2f modules, and SPPF modules, which are used to extract image features from the input images of the cage to form feature sets for different categories of images. The feature pyramid structure in the neck network module fuses the semantic and positional information of the cage position and cage box through upsampling and downsampling; The head network module outputs the predicted bounding boxes of each target image, the category of the cage position and the pixel coordinates predicted by each predicted bounding box, in an anchorless manner.

6. The intelligent identification method for cage positions and cage boxes according to claim 5, characterized in that: The YOLOv8 detection model uses the DFL loss function to calculate the regression value corresponding to each prediction box in a probabilistic manner.

7. The intelligent identification method for cage positions and cage boxes according to claim 5, characterized in that: The feature pyramid structure in the neck network module is equipped with a channel attention module. The channel attention module uses high-level semantic features as weights to filter low-level features, and then adds and fuses the filtered features with high-level semantic features point by point to generate a feature map rich in semantic details.

8. The intelligent identification method for cage positions and cage boxes according to claim 1, characterized in that: During training, the YOLOv8 detection model expands the training dataset by using one or more of the following methods: blurring, vertical flipping, rotation, mesh distortion, affine transformation, and saturation adjustment.

9. An electronic device, characterized in that, include: Includes memory used to store computer programs; A processor for running the computer program to implement the steps of the intelligent identification method for cage positions and cage boxes as described in any one of claims 1 to 8.

10. A computer storage medium storing program instructions, characterized in that: When the program instructions are executed, they implement the steps of the intelligent identification method for cage positions and cage boxes as described in any one of claims 1 to 8.