A method, apparatus and storage medium for storing pedestrian walking sequence diagrams
By scaling and selecting the storage method for each frame of the pedestrian walking sequence image, the problems of large storage space occupation and serious information loss are solved, and more efficient storage is achieved.
Patent Information
- Application Number
- CN202210699220.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-20
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2042-06-20
AI Technical Summary
Existing technologies consume a large amount of storage space and suffer significant information loss when storing pedestrian walking sequence images.
By acquiring each frame of pedestrian image from the walking sequence, scaling the image size of the gait feature map, image background segmentation feature map, and face feature map, and determining the storage format (video or image) based on the number of sequence frames, the images are then stitched together and stored.
This reduces the storage space required for pedestrian walking sequence diagrams and minimizes information loss.
Smart Images

Figure CN115063722B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to a method, apparatus and storage medium for storing pedestrian walking sequence images. Background Technology
[0002] A pedestrian walking sequence diagram is a dynamic sequence of a pedestrian walking from location A to location B over a period of time. Typically, pedestrian walking sequence diagrams can be obtained from surveillance videos or through other means.
[0003] Nowadays, pedestrian walking sequence Figure 1 Pedestrian walking sequence images are generally used in criminal investigation monitoring to identify suspects. However, these images are often stored directly without compression, resulting in large storage space requirements. Alternatively, direct compression can lead to significant information loss. Therefore, reducing storage space usage and information loss during the storage of pedestrian walking sequence images has become a significant technical challenge. Summary of the Invention
[0004] In view of this, the purpose of this application is to provide a method, apparatus and storage medium for storing pedestrian walking sequence images. By determining different storage methods according to the number of sequence frames corresponding to the walking sequence images, and then using the corresponding storage methods to stitch and store the images, the storage space occupied by storing pedestrian walking sequence images can be reduced while reducing the overall loss of image information in the pedestrian walking sequence images.
[0005] This application provides a method for storing pedestrian walking sequence diagrams, the storage method including:
[0006] Obtain the walking sequence image of the target pedestrian;
[0007] For each frame of pedestrian image in the walking sequence diagram, the image size of the gait feature map, image background segmentation feature map and face feature map corresponding to each frame of pedestrian image is scaled.
[0008] Based on the number of frames corresponding to the walking sequence image, the storage method for the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian image is determined; wherein, the storage method includes video format storage method and image format storage method;
[0009] Based on the determined storage method and the temporal order of each frame of pedestrian images in the walking sequence diagram, the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian images after scaling the image size are stitched together to generate the target storage image corresponding to the walking sequence diagram.
[0010] In one possible implementation, scaling the image size of the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of the walking sequence image includes:
[0011] Obtain the preset size corresponding to each frame of the image; the preset size is the width or height of the image after scaling the gait feature map, image background segmentation feature map and face feature map corresponding to each frame of the pedestrian image.
[0012] Based on the first actual size, the second actual size, and the preset size of the gait feature map, a first scaling size of the gait feature map is determined, and the gait feature map is scaled according to the preset size and the first scaling size;
[0013] Based on the first actual size, the second actual size, and the preset size of the image background segmentation feature map, a second scaling size of the image background segmentation feature map is determined, and the image background segmentation feature map is scaled according to the preset size and the second scaling size;
[0014] Based on the first actual size, the second actual size, and the preset size of the face feature map, a third scaling size of the face feature map is determined, and the image background segmentation feature map is scaled according to the preset size and the third scaling size.
[0015] In one possible implementation, the method for storing the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian image based on the sequence frame number corresponding to the walking sequence map includes:
[0016] Determine whether the number of sequence frames in the walking sequence diagram is less than the preset number of sequence frames;
[0017] If so, then the storage method for the gait feature map, the image background segmentation feature map, and the face feature map corresponding to each frame of pedestrian image is determined to be image format storage method;
[0018] If not, then the storage method for the gait feature map, the image background segmentation feature map, and the face feature map corresponding to each frame of pedestrian image is determined to be video format storage.
[0019] In one possible implementation, if the determined storage method is an image format storage method, the step of stitching together the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian images after scaling the image size, based on the determined storage method and the temporal order of each frame of pedestrian images in the walking sequence image, to generate the target storage image corresponding to the walking sequence image, includes:
[0020] Determine the first overall size of the gait feature map, the image background segmentation feature map, and the face feature map corresponding to each frame of pedestrian image after scaling the image size;
[0021] The maximum arrangement size is selected from the first total size corresponding to each frame of the pedestrian image in the walking sequence diagram of the target pedestrian;
[0022] A first jigsaw puzzle template is determined based on the maximum arrangement size and the second total size; the second total size is determined based on the number of sequence frames and the preset size corresponding to each frame of pedestrian image.
[0023] According to the time sequence of each frame of pedestrian images in the walking sequence diagram, the gait feature map, image background segmentation feature map and face feature map corresponding to each frame of pedestrian images after scaling the image size are placed on the first stitching template and stitched together to generate the target storage image.
[0024] In one possible implementation, if the determined storage method is a video format storage method, the step of stitching together the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian images after scaling the image size, based on the determined storage method and the temporal order of each frame of pedestrian images in the walking sequence image, and performing image encoding to generate the target stored image corresponding to the walking sequence image, includes:
[0025] Based on the total height and total width of the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian image with scaled image size, the second mosaic template corresponding to each frame of pedestrian image is determined.
[0026] The gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian image after scaling the image size are placed on the corresponding second stitching template and stitched together to determine the stitched image corresponding to each frame of pedestrian image.
[0027] According to the time sequence of each frame of pedestrian images in the walking sequence diagram, the stitched image corresponding to each frame of pedestrian images is video encoded to generate the target storage image.
[0028] In one possible implementation, the step of stitching together the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian images after scaling the image size, based on the determined storage method and the temporal order of each frame of pedestrian images in the walking sequence map, to generate the target stored image corresponding to the walking sequence map, includes:
[0029] Color channel conversion is performed on the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian image after scaling the image size;
[0030] Based on the determined storage method and the temporal order of each frame of pedestrian images in the walking sequence diagram, the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian images after color channel conversion are stitched together to generate the target storage image corresponding to the walking sequence diagram.
[0031] This application embodiment also provides a storage device for pedestrian walking sequence diagrams, the storage device comprising:
[0032] The acquisition module is used to acquire the walking sequence image of the target pedestrian;
[0033] The scaling module is used to scale the image size of the gait feature map, image background segmentation feature map and face feature map corresponding to each frame of pedestrian image in the walking sequence map.
[0034] The storage method determination module is used to determine the storage method of the gait feature map, image background segmentation feature map and face feature map corresponding to each frame of pedestrian image based on the number of sequence frames corresponding to the walking sequence map; wherein, the storage method includes video format storage method and image format storage method;
[0035] The image storage module is used to stitch together the gait feature map, image background segmentation feature map and face feature map corresponding to each frame of pedestrian images after scaling the image size, based on the determined storage method and the time order of each frame of pedestrian images in the walking sequence map, to generate the target storage image corresponding to the walking sequence map.
[0036] In one possible implementation, when the scaling module scales the image size of the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of the pedestrian image in the walking sequence map, the scaling module is specifically used for:
[0037] Obtain the preset size corresponding to each frame of the image; the preset size is the width or height of the image after scaling the gait feature map, image background segmentation feature map and face feature map corresponding to each frame of the pedestrian image.
[0038] Based on the first actual size, the second actual size, and the preset size of the gait feature map, a first scaling size of the gait feature map is determined, and the gait feature map is scaled according to the preset size and the first scaling size;
[0039] Based on the first actual size, the second actual size, and the preset size of the image background segmentation feature map, a second scaling size of the image background segmentation feature map is determined, and the image background segmentation feature map is scaled according to the preset size and the second scaling size;
[0040] Based on the first actual size, the second actual size, and the preset size of the face feature map, a third scaling size of the face feature map is determined, and the image background segmentation feature map is scaled according to the preset size and the third scaling size.
[0041] This application embodiment also provides an electronic device, including: a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus. When the machine-readable instructions are executed by the processor, the steps of the pedestrian walking sequence diagram storage method described above are performed.
[0042] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the pedestrian walking sequence diagram storage method described above.
[0043] This application provides a method, apparatus, and storage medium for storing pedestrian walking sequence images. The storage method includes: acquiring a walking sequence image of a target pedestrian; scaling the image size of the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of the walking sequence image; determining the storage method for the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of the pedestrian image based on the number of frames corresponding to the walking sequence image; wherein the storage method includes video format storage and image format storage; and stitching the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of the pedestrian image after scaling the image size based on the determined storage method and the time order of each frame of the pedestrian image in the walking sequence image to generate a target stored image corresponding to the walking sequence image. By determining different storage methods according to the number of frames corresponding to the walking sequence image, and then using the corresponding storage methods to stitch and store the image, the storage space of the pedestrian walking sequence image is reduced and information loss is minimized.
[0044] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0045] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0046] Figure 1 A flowchart illustrating a method for storing pedestrian walking sequence diagrams provided in an embodiment of this application;
[0047] Figure 2 A flowchart illustrating an image format storage method for a pedestrian walking sequence diagram provided in an embodiment of this application;
[0048] Figure 3 A flowchart illustrating a video format storage method for pedestrian walking sequence images provided in this application embodiment;
[0049] Figure 4 A schematic diagram of the structure of a storage device for a pedestrian walking sequence diagram provided in an embodiment of this application;
[0050] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0051] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the drawings in this application are for illustrative and descriptive purposes only and are not intended to limit the scope of protection of this application. Furthermore, it should be understood that the schematic drawings are not drawn to scale. The flowcharts used in this application illustrate operations implemented according to some embodiments of this application. It should be understood that the operations in the flowcharts may not be implemented in sequence, and steps without logical contextual relationships may be reversed or implemented simultaneously. In addition, those skilled in the art, guided by the content of this application, may add one or more other operations to the flowcharts, or remove one or more operations from the flowcharts.
[0052] Furthermore, the described embodiments are merely some, not all, of the embodiments of this application. The components of the embodiments of this application described and illustrated herein can typically be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0053] To enable those skilled in the art to use the content of this application and, in conjunction with the specific application scenario of "storing images," the following implementation methods are provided. For those skilled in the art, the general principles defined herein can be applied to other embodiments and application scenarios without departing from the spirit and scope of this application.
[0054] The methods, apparatus, electronic devices, or computer-readable storage media described in this application can be applied to any scenario that requires image storage. This application does not limit the specific application scenario. Any solution that uses the pedestrian walking sequence image storage method, apparatus, and storage medium provided in this application is within the protection scope of this application.
[0055] First, the applicable scenarios for this application will be introduced. This application can be applied to the field of image storage technology.
[0056] Research has revealed pedestrian walking sequences Figure 1 Pedestrian walking sequence images are generally used in criminal investigation monitoring to identify suspects. However, these images are often stored directly without compression, resulting in large storage space requirements. Alternatively, direct compression can lead to significant information loss. Therefore, reducing storage space usage and information loss during the storage of pedestrian walking sequence images has become a significant technical challenge.
[0057] Based on this, embodiments of this application provide a method for storing pedestrian walking sequence diagrams, so as to reduce the storage space of pedestrian walking sequence diagrams and reduce information loss.
[0058] Please see Figure 1 , Figure 1 This is a flowchart illustrating a method for storing pedestrian walking sequence diagrams provided in an embodiment of this application. Figure 1 As shown in the embodiments of this application, the storage method includes:
[0059] S101: Obtain the walking sequence image of the target pedestrian.
[0060] In this step, a walking sequence of the target pedestrian from location A to location B can be obtained from a surveillance video.
[0061] Here, the walking sequence diagram is a motion image of the target pedestrian walking from location A to location B.
[0062] S102: For each frame of pedestrian image in the walking sequence diagram, scale the image size of the gait feature map, image background segmentation feature map and face feature map corresponding to each frame of pedestrian image.
[0063] In this step, for each frame of pedestrian image in the walking sequence image, the image size of the corresponding gait feature map, image background segmentation feature map and face feature map is scaled.
[0064] Here, the gait feature map is the feature map of the target user's walking posture, the background image segmentation feature map is the feature map generated after segmenting the human body contour of the target pedestrian with the external environment, and the face feature map is the facial expression feature map of the target user.
[0065] Here, the gait feature map, image background segmentation feature map, and face feature map are scaled proportionally to a fixed width W, with a variable height (or, a fixed height and a variable width) to facilitate stitching in the horizontal or vertical direction.
[0066] In one possible implementation, scaling the image size of the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of the walking sequence image includes:
[0067] A: Obtain the preset size corresponding to each frame of the image; the preset size is the width or height of the image after scaling the gait feature map, image background segmentation feature map and face feature map corresponding to each frame of the pedestrian image.
[0068] The preset size is the width (W) or height (H) of the image size after scaling the gait feature map, image background segmentation feature map and face feature map corresponding to each frame of pedestrian image.
[0069] B: Based on the first actual size, the second actual size, and the preset size of the gait feature map, determine the first scaling size of the gait feature map, and scale the gait feature map according to the preset size and the first scaling size.
[0070] Specifically, when the first actual size is width (w), the second actual size is height (h), and the preset size is (the scaled width size is W), the first scaled size (H) = h*W / w is determined based on (w, h) of the gait feature map and the preset size (W).
[0071] Specifically, when the first actual size is width (w), the second actual size is height (h), and the first preset size is (the scaled height size is H), the first scaled size (W) = W*H / h is determined based on (w, h) of the gait feature map and the preset size (H).
[0072] C: Based on the first actual size, the second actual size, and the preset size of the image background segmentation feature map, determine the second scaling size of the image background segmentation feature map, and scale the image background segmentation feature map according to the preset size and the second scaling size.
[0073] Specifically, when the first actual size is width (w), the second actual size is height (h), and the preset size is (the scaled width size is W), the second scaled size (H) = h*W / w is determined based on the image background segmentation feature map (w, h) and the preset size (W).
[0074] Specifically, when the first actual size is width (w), the second actual size is height (h), and the preset size is (the height after scaling is H), the second scaling size (W) = W*H / h is determined based on the image background segmentation feature map (w, h) and the preset size (H).
[0075] Here, the image size of the background segmentation feature map can be set to be the same as the image size of the corresponding gait feature map.
[0076] C: Based on the first actual size, the second actual size, and the preset size of the face feature map, determine the third scaling size of the face feature map, and scale the image background segmentation feature map according to the preset size and the third scaling size.
[0077] Specifically, when the first actual size is width (w), the second actual size is height (h), and the preset size is (the scaled width size is W), the third scaled size (H) = h*W / w is determined based on the face feature map (w, h) and the preset size (W).
[0078] Specifically, when the first actual size is width (w), the second actual size is height (h), and the preset size is (the height after scaling is H), the third scaling size (W) = W*H / h is determined based on the face feature map (w, h) and the preset size (H).
[0079] Specifically, when the first actual size and the second actual size are equal, the facial feature map is scaled proportionally according to the preset size.
[0080] Here, the scaling size (such as the height) is determined using a preset size (such as the width), and the image is scaled proportionally according to the preset size and the scaled size. Compared with non-proportional scaling, this can reduce the loss of image information to a certain extent.
[0081] S103: Based on the number of sequence frames corresponding to the walking sequence image, determine the storage method of the gait feature map, image background segmentation feature map and face feature map corresponding to each frame of pedestrian image; wherein, the storage method includes video format storage method and image format storage method.
[0082] In this step, based on the number of sequence frames corresponding to the walking sequence image, the storage method for the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian image is determined.
[0083] The storage methods include video format storage and image format storage.
[0084] In one possible implementation, the method for storing the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian image based on the sequence frame number corresponding to the walking sequence map includes:
[0085] a: Determine whether the number of sequence frames in the walking sequence diagram is less than the preset number of sequence frames.
[0086] Here, the preset number of sequence frames can be set based on expert experience; this part does not limit the method of setting the preset number of sequence frames.
[0087] b: If so, then the storage method for the gait feature map, the image background segmentation feature map, and the face feature map corresponding to each frame of pedestrian image is determined to be image format storage.
[0088] c: If not, then the storage method for the gait feature map, the image background segmentation feature map, and the face feature map corresponding to each frame of pedestrian image is determined to be video format storage.
[0089] In a specific embodiment, it is determined whether the number of sequence frames in the walking sequence image is less than a preset number of sequence frames. If so, the storage method for the gait feature map, the image background segmentation feature map, and the face feature map corresponding to each frame of pedestrian image is determined to be image format storage; if not, the storage method for the gait feature map, the image background segmentation feature map, and the face feature map corresponding to each frame of pedestrian image is determined to be video format storage, thereby realizing the determination of the corresponding storage method. Determining the image storage method by the number of sequence frames—if the number of sequence frames is small, image format storage is used; if the number of sequence frames is large, video format storage is used—achieves a balance between loss and storage space occupation, minimizing overall loss.
[0090] S104: Based on the determined storage method and the time order of each frame of pedestrian images in the walking sequence diagram, the gait feature map, image background segmentation feature map and face feature map corresponding to each frame of pedestrian images after scaling the image size are stitched together to generate the target storage image corresponding to the walking sequence diagram.
[0091] In this step, using the determined storage method and the temporal order of each frame of pedestrian images in the walking sequence image, the gait feature map, image background segmentation feature map and face feature map corresponding to each frame of pedestrian images after scaling the image size are stitched together to generate the target storage image corresponding to the walking sequence image.
[0092] In one possible implementation, please refer to Figure 2 , Figure 2 This is a flowchart illustrating a method for storing image formats of pedestrian walking sequence diagrams, as provided in an embodiment of this application. Figure 2 As shown, it includes:
[0093] S201: Determine the first overall size of the gait feature map, the image background segmentation feature map, and the face feature map corresponding to each frame of pedestrian image after scaling the image size.
[0094] In this step, the first overall size of the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian image after the image size has been determined is calculated.
[0095] Here, the first overall size is determined by horizontally or vertically stitching together the gait feature map, image background segmentation feature map, and face feature map corresponding to a pedestrian image frame.
[0096] For example, if the image size of the gait feature map corresponding to a frame of pedestrian image after scaling is (w1, h1), the image size of the background segmentation feature map is (w1, h1), and the image size of the face feature map is (w1, w1), and the three feature maps are arranged vertically, the size information after arrangement is (3w1, 2h1+w1). 2h1+w1 is taken as the first total size. The same applies to the horizontal arrangement. This part will not be elaborated further.
[0097] S202: Select the largest arrangement size from the first total size corresponding to each frame of the pedestrian image in the walking sequence diagram of the target pedestrian.
[0098] In this step, the largest permutation size is selected from multiple first total sizes.
[0099] S203: Based on the maximum arrangement size and the second total size, a first jigsaw puzzle template is determined; the second total size is determined based on the number of sequence frames and the preset size corresponding to each frame of pedestrian image.
[0100] In this step, the first puzzle template is determined based on the maximum arrangement size and the second total size.
[0101] Here, the second total size is determined by the product of the number of sequence frames corresponding to the walking sequence diagram and the preset size.
[0102] Here, if it is arranged vertically, the maximum arrangement size (maxH) information is selected from multiple first total sizes arranged vertically as the height of the first jigsaw puzzle template, and the width of the first jigsaw puzzle template is obtained by multiplying the preset size (width W) and the number of sequence frames corresponding to the walking sequence map.
[0103] Here, if the arrangement is horizontal, the largest arrangement size (maxW) is selected from multiple first total sizes in the horizontal arrangement as the width of the first puzzle template, and the product of the preset size (height H) and the number of sequence frames corresponding to the walking sequence map is used as the height of the first puzzle template.
[0104] Here, the gait feature map, image background segmentation feature map, and face feature map of the same frame are arranged vertically, with the width of each frame fixed and the height taken as the maximum height of all images.
[0105] S204: According to the time order of each frame of pedestrian images in the walking sequence diagram, place the gait feature map, image background segmentation feature map and face feature map corresponding to each frame of pedestrian images after scaling the image size on the first stitching template and stitch them together to generate the target storage image.
[0106] In this step, the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian images after scaling the image size are placed in the first stitching template and stitched together to generate the target storage image.
[0107] For example, based on the temporal order of each frame of pedestrian images, the image size (W, h) of the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian images after scaling the image size, the sequence number (i) of the frame in the walking sequence image, and the preset stitching method (vertical stitching), the gait feature map is copied to the upper left corner coordinate (i*W, maxH-h) of the first stitching template (maximum arrangement size is height, second total size is width), with a width and height of (W, h). The image background segmentation feature map is the next maxH area, and the face feature map is the upper left corner (i*W, 2*maxH), with a width and height of (W, W). This process is repeated for other frames of pedestrian images.
[0108] In a specific embodiment, a walking sequence image of the target pedestrian is obtained. The image size of each frame of the walking sequence image is scaled to determine a first stitching template. Using the temporal order of the various frames of the walking sequence image and a preset stitching method, the gait feature maps, image background segmentation feature maps, and face feature maps corresponding to each frame of the scaled image are placed at preset positions on the first stitching template to stitch the images into JPG images. The copied images are then image-encoded to generate a target storage image. A unique identifier is generated for the target storage image according to certain rules, and the image is stored in the system disk space and database. This achieves the stitching and storage of multiple images with temporal continuity and sequential content relationships, using multiple gait feature maps, image background segmentation feature maps, and face feature maps. Furthermore, stitching the images onto a single stitching template reduces storage space usage.
[0109] For further details, please refer to Figure 3 , Figure 3 A flowchart illustrating a video format storage method for pedestrian walking sequence images provided in this application embodiment is shown below. Figure 3 As shown:
[0110] S301: Based on the total height and width of the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian image after scaling the image size, determine the second jigsaw puzzle template corresponding to each frame of pedestrian image.
[0111] In this step, the second mosaic template corresponding to each frame of pedestrian image is determined based on the total height and total width of the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian image with scaled image size.
[0112] Here, the total height dimension is the height of the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian image after scaling the image size, and the total width dimension is the width of the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian image after bottom alignment.
[0113] S302: Place the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian image after scaling the image size onto the corresponding second stitching template and stitch them together to determine the stitched image corresponding to each frame of pedestrian image.
[0114] In this step, the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian image after scaling the image size are placed on a second stitching template and stitched together to generate a stitched image.
[0115] Here, the stitching method is video stitching, which can be used to stitch three feature maps horizontally or vertically.
[0116] For example, if three feature maps are vertically stitched together using video stitching, the image sizes (W, h) of the gait feature map, background segmentation feature map, and face feature map corresponding to each frame of pedestrian image are scaled according to the time sequence of each frame. The gait feature map is copied to the upper left corner (0, fixedH-h) of the second stitching template, with a width and height of (W, h), the background segmentation feature map is copied to the right by one W, and the face feature map is copied to the upper left corner (2*W, 0), with a width and height of (W, W). The above processing is performed on each frame of pedestrian image to obtain multiple stitched images.
[0117] S303: According to the time sequence of each frame of pedestrian images in the walking sequence diagram, perform video encoding on the stitched image corresponding to each frame of pedestrian images to generate the target storage image.
[0118] In this step, the stitched image is video encoded according to the temporal order of each frame of pedestrian images in the walking sequence image to generate the target storage image.
[0119] Here, the three types of feature maps of each pedestrian image are placed on a second template, and then video encoding is performed on multiple second templates with placed images, which can reduce the storage space occupied.
[0120] To reduce hard drive space requirements, images are typically encoded as JPGs. Encoding methods can include OpenCV's `imencode` or the corresponding methods in FFmpeg. If the device has a GPU that supports JPEG encoding, hardware encoding can speed up the process and reduce CPU usage. Videos are generally encoded as MP4 files in H.264 format, which can be achieved using OpenCV's `VideoWriter` or the corresponding methods in FFmpeg.
[0121] Furthermore, based on the determined storage method and the temporal order of each frame of pedestrian images in the walking sequence image, the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian images after scaling the image size are stitched together to generate the target storage image corresponding to the walking sequence image, including:
[0122] I: Perform color channel conversion on the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian images after scaling the image size.
[0123] Here, the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian image after scaling are converted to color channels to ensure that the input images have consistent channels during image stitching. If the segmentation feature map is single-channel, it needs to be converted to three-channel. After scaling the image size, the color channels of each image are converted to reduce the information loss of the image during the color channel conversion process.
[0124] II: Based on the determined storage method and the time order of each frame of pedestrian images in the walking sequence diagram, the gait feature map, image background segmentation feature map and face feature map corresponding to each frame of pedestrian images after color channel conversion are stitched together to generate the target storage image corresponding to the walking sequence diagram.
[0125] Here, the process of stitching together the gait feature maps, image background segmentation feature maps, and face feature maps corresponding to each frame of pedestrian images after color channel conversion to generate the target storage image corresponding to the walking sequence image is consistent with the above-mentioned target storage image generation process, and will not be repeated here.
[0126] Here, each image is converted to a unified color channel before storage, which facilitates unified image processing later.
[0127] In a specific embodiment, a walking sequence image of the target pedestrian is obtained. The image size of each frame of the walking sequence image is scaled. Color channel conversion is performed on the gait feature map, background segmentation feature map, and face feature map corresponding to each frame of the scaled image. A second stitching template is determined. The gait feature map, background segmentation feature map, and face feature map corresponding to each frame of the color-channel converted pedestrian image are placed at preset positions on a second stitching template for video stitching, resulting in multiple reference stitched images. These reference stitched images are then processed with video encoding according to the temporal order of the individual frames of the pedestrian image to generate a target storage image. A unique identifier is generated for the target storage image according to certain rules, and the image is stored in the system disk space and database. This achieves the stitching and storage of multiple gait feature maps, background segmentation feature maps, and face feature maps that are temporally continuous and have a sequential relationship.
[0128] This application provides a method for storing a pedestrian walking sequence image. The method includes: acquiring a walking sequence image of a target pedestrian; scaling the image size of the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of the walking sequence image; determining the storage method for the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of the walking sequence image based on the number of frames corresponding to the walking sequence image; wherein the storage method includes video format storage and image format storage; and stitching the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of the walking sequence image after scaling the image size, based on the determined storage method and the time order of each frame of the walking sequence image, to generate a target stored image corresponding to the walking sequence image. By determining different storage methods according to the number of frames corresponding to the walking sequence image, and then using the corresponding storage methods to stitch and store the image, the storage space occupied by storing the pedestrian walking sequence image can be reduced while reducing the overall loss of image information in the pedestrian walking sequence image.
[0129] Please see Figure 4 , Figure 4 This is a schematic diagram of the structure of a storage device for a pedestrian walking sequence diagram provided in an embodiment of this application. Figure 4 As shown, the storage device 400 for the pedestrian walking sequence diagram includes:
[0130] The acquisition module 410 is used to acquire the walking sequence image of the target pedestrian;
[0131] The scaling module 420 is used to scale the image size of the gait feature map, image background segmentation feature map and face feature map corresponding to each frame of pedestrian image in the walking sequence map.
[0132] The storage method determination module 430 is used to determine the storage method of the gait feature map, image background segmentation feature map and face feature map corresponding to each frame of pedestrian image based on the number of sequence frames corresponding to the walking sequence map; wherein, the storage method includes video format storage method and image format storage method;
[0133] The image storage module 440 is used to stitch together the gait feature map, image background segmentation feature map and face feature map corresponding to each frame of pedestrian images after scaling the image size, based on the determined storage method and the time order of each frame of pedestrian images in the walking sequence map, to generate the target storage image corresponding to the walking sequence map.
[0134] Furthermore, when scaling the image size of the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of the walking sequence image, the scaling module 420 is specifically used for:
[0135] Obtain the preset size corresponding to each frame of the image; the preset size is the width or height of the image after scaling the gait feature map, image background segmentation feature map and face feature map corresponding to each frame of the pedestrian image.
[0136] Based on the first actual size, the second actual size, and the preset size of the gait feature map, a first scaling size of the gait feature map is determined, and the gait feature map is scaled according to the preset size and the first scaling size;
[0137] Based on the first actual size, the second actual size, and the preset size of the image background segmentation feature map, a second scaling size of the image background segmentation feature map is determined, and the image background segmentation feature map is scaled according to the preset size and the second scaling size;
[0138] Based on the first actual size, the second actual size, and the preset size of the face feature map, a third scaling size of the face feature map is determined, and the image background segmentation feature map is scaled according to the preset size and the third scaling size.
[0139] Furthermore, when the storage method determination module 430 determines the storage method of the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian image based on the number of sequence frames corresponding to the walking sequence map, the storage method determination module 430 is specifically used for:
[0140] Determine whether the number of sequence frames in the walking sequence diagram is less than the preset number of sequence frames;
[0141] If so, then the storage method for the gait feature map, the image background segmentation feature map, and the face feature map corresponding to each frame of pedestrian image is determined to be image format storage method;
[0142] If not, then the storage method for the gait feature map, the image background segmentation feature map, and the face feature map corresponding to each frame of pedestrian image is determined to be video format storage.
[0143] Furthermore, when the image storage module 440 is used to, if the determined storage method is an image format storage method, and based on the determined storage method and the temporal order of each frame of pedestrian images in the walking sequence image, stitch together the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian images after scaling the image size to generate the target storage image corresponding to the walking sequence image, the image storage module 440 is specifically used for:
[0144] Determine the first overall size of the gait feature map, the image background segmentation feature map, and the face feature map corresponding to each frame of pedestrian image after scaling the image size;
[0145] The maximum arrangement size is selected from the first total size corresponding to each frame of the pedestrian image in the walking sequence diagram of the target pedestrian;
[0146] A first jigsaw puzzle template is determined based on the maximum arrangement size and the second total size; the second total size is determined based on the number of sequence frames and the preset size corresponding to each frame of pedestrian image.
[0147] According to the time sequence of each frame of pedestrian images in the walking sequence diagram, the gait feature map, image background segmentation feature map and face feature map corresponding to each frame of pedestrian images after scaling the image size are placed on the first stitching template and stitched together to generate the target storage image.
[0148] Furthermore, if the determined storage method is a video format storage method, the image storage module 440, based on the determined storage method and the temporal order of each frame of pedestrian images in the walking sequence image, stitches together the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian images after scaling the image size, and performs image encoding to generate the target storage image corresponding to the walking sequence image. Specifically, the image storage module 440 is used for:
[0149] Based on the total height and total width of the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian image with scaled image size, the second mosaic template corresponding to each frame of pedestrian image is determined.
[0150] The gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian image after scaling the image size are placed on the corresponding second stitching template and stitched together to determine the stitched image corresponding to each frame of pedestrian image.
[0151] According to the time sequence of each frame of pedestrian images in the walking sequence diagram, the stitched image corresponding to each frame of pedestrian images is video encoded to generate the target storage image.
[0152] Furthermore, when the image storage module 440 stitches together the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian images after scaling the image size, based on the determined storage method and the temporal order of each frame of pedestrian images in the walking sequence map, to generate the target stored image corresponding to the walking sequence map, the image storage module 440 is specifically used for:
[0153] Color channel conversion is performed on the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian image after scaling the image size;
[0154] Based on the determined storage method and the temporal order of each frame of pedestrian images in the walking sequence diagram, the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian images after color channel conversion are stitched together to generate the target storage image corresponding to the walking sequence diagram.
[0155] This application provides a storage device for a pedestrian walking sequence image. The storage device includes: an acquisition module for acquiring a walking sequence image of a target pedestrian; a scaling module for scaling the image size of the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of the pedestrian image in the walking sequence image; a storage method determination module for determining the storage method of the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of the pedestrian image based on the number of sequence frames corresponding to the walking sequence image; wherein the storage method includes a video format storage method and an image format storage method; and an image storage module for stitching together the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of the pedestrian image after scaling the image size, based on the determined storage method and the time order of each frame of the pedestrian image in the walking sequence image, to generate a target stored image corresponding to the walking sequence image. By determining different storage methods based on the number of sequence frames corresponding to the walking sequence image, and then using the corresponding storage methods to stitch and store the images, the storage space occupied by storing the pedestrian walking sequence image can be reduced while reducing the overall loss of image information in the pedestrian walking sequence image.
[0156] Please see Figure 5 , Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 5 As shown, the electronic device 500 includes a processor 510, a memory 520, and a bus 530.
[0157] The memory 520 stores machine-readable instructions executable by the processor 510. When the electronic device 500 is running, the processor 510 and the memory 520 communicate via the bus 530. When the machine-readable instructions are executed by the processor 510, they can perform the operations described above. Figure 1 The steps of the method for storing the pedestrian walking sequence diagram in the method embodiment shown are described in detail in the method embodiment, and will not be repeated here.
[0158] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, can perform the above-described actions. Figure 1 The steps of the method for storing the pedestrian walking sequence diagram in the method embodiment shown are described in detail in the method embodiment, and will not be repeated here.
[0159] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0160] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the shown or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.
[0161] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0162] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0163] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0164] Finally, it should be noted that the above-described embodiments are merely specific implementations of this application, used to illustrate the technical solutions of this application, and not to limit them. The scope of protection of this application is not limited thereto. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this application. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for storing pedestrian walking sequence diagrams, characterized in that, The storage method includes: Obtain the walking sequence image of the target pedestrian; For each frame of pedestrian image in the walking sequence diagram, the image size of the gait feature map, image background segmentation feature map and face feature map corresponding to each frame of pedestrian image is scaled. Based on the number of frames corresponding to the walking sequence image, the storage method for the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian image is determined; wherein, the storage method includes video format storage method and image format storage method; Based on the determined storage method and the temporal order of each frame of pedestrian images in the walking sequence diagram, the gait feature map, image background segmentation feature map and face feature map corresponding to each frame of pedestrian images after scaling the image size are stitched together to generate the target storage image corresponding to the walking sequence diagram. If the determined storage method is a video format storage method, based on the determined storage method and the temporal order of each frame of pedestrian images in the walking sequence image, the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian images after scaling the image size are stitched together, and image encoding is performed to generate the target storage image corresponding to the walking sequence image, including: Based on the total height and total width of the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian image with scaled image size, the second mosaic template corresponding to each frame of pedestrian image is determined. The gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian image after scaling the image size are placed on the corresponding second stitching template and stitched together to determine the stitched image corresponding to each frame of pedestrian image. According to the time sequence of each frame of pedestrian images in the walking sequence diagram, the stitched image corresponding to each frame of pedestrian images is video encoded to generate the target storage image.
2. The storage method according to claim 1, characterized in that, The step of scaling the image size of the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of the walking sequence image includes: Obtain the preset size corresponding to each frame of the image; the preset size is the width or height of the image after scaling the gait feature map, image background segmentation feature map and face feature map corresponding to each frame of the pedestrian image. Based on the first actual size, the second actual size, and the preset size of the gait feature map, a first scaling size of the gait feature map is determined, and the gait feature map is scaled according to the preset size and the first scaling size; Based on the first actual size, the second actual size, and the preset size of the image background segmentation feature map, a second scaling size of the image background segmentation feature map is determined, and the image background segmentation feature map is scaled according to the preset size and the second scaling size; Based on the first actual size, the second actual size, and the preset size of the face feature map, a third scaling size of the face feature map is determined, and the image background segmentation feature map is scaled according to the preset size and the third scaling size.
3. The storage method according to claim 1, characterized in that, The method for determining the storage of gait feature maps, image background segmentation feature maps, and face feature maps corresponding to each frame of pedestrian images based on the sequence number corresponding to the walking sequence map includes: Determine whether the number of sequence frames in the walking sequence diagram is less than the preset number of sequence frames; If so, then the storage method for the gait feature map, the image background segmentation feature map, and the face feature map corresponding to each frame of pedestrian image is determined to be image format storage method; If not, then the storage method for the gait feature map, the image background segmentation feature map, and the face feature map corresponding to each frame of pedestrian image is determined to be video format storage.
4. The storage method according to claim 2, characterized in that, If the determined storage method is an image format storage method, the step of stitching together the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian images after scaling the image size, based on the determined storage method and the time order of each frame of pedestrian images in the walking sequence image, to generate the target storage image corresponding to the walking sequence image, includes: Determine the first overall size of the gait feature map, the image background segmentation feature map, and the face feature map corresponding to each frame of pedestrian image after scaling the image size; The maximum arrangement size is selected from the first total size corresponding to each frame of the pedestrian image in the walking sequence diagram of the target pedestrian; A first jigsaw puzzle template is determined based on the maximum arrangement size and the second total size; the second total size is determined based on the number of sequence frames and the preset size corresponding to each frame of pedestrian image. According to the time sequence of each frame of pedestrian images in the walking sequence diagram, the gait feature map, image background segmentation feature map and face feature map corresponding to each frame of pedestrian images after scaling the image size are placed on the first stitching template and stitched together to generate the target storage image.
5. The storage method according to claim 1, characterized in that, Based on the determined storage method and the temporal order of each frame of pedestrian images in the walking sequence image, the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian images after scaling the image size are stitched together to generate the target storage image corresponding to the walking sequence image, including: Color channel conversion is performed on the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian image after scaling the image size; Based on the determined storage method and the temporal order of each frame of pedestrian images in the walking sequence diagram, the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian images after color channel conversion are stitched together to generate the target storage image corresponding to the walking sequence diagram.
6. A storage device for a pedestrian walking sequence diagram, characterized in that, The storage device includes: The acquisition module is used to acquire the walking sequence image of the target pedestrian; The scaling module is used to scale the image size of the gait feature map, image background segmentation feature map and face feature map corresponding to each frame of pedestrian image in the walking sequence map. The storage method determination module is used to determine the storage method of the gait feature map, image background segmentation feature map and face feature map corresponding to each frame of pedestrian image based on the number of sequence frames corresponding to the walking sequence map; wherein, the storage method includes video format storage method and image format storage method; The image storage module is used to stitch together the gait feature map, image background segmentation feature map and face feature map corresponding to each frame of pedestrian images after scaling the image size, based on the determined storage method and the time order of each frame of pedestrian images in the walking sequence map, to generate the target storage image corresponding to the walking sequence map. The image storage module, if the determined storage method is video format storage, performs the following steps based on the determined storage method and the temporal order of each frame of pedestrian images in the walking sequence image: stitching together the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian images after scaling the image size; and performing image encoding to generate the target storage image corresponding to the walking sequence image. Specifically, the image storage module is used for: Based on the total height and total width of the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian image with scaled image size, the second mosaic template corresponding to each frame of pedestrian image is determined. The gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of pedestrian image after scaling the image size are placed on the corresponding second stitching template and stitched together to determine the stitched image corresponding to each frame of pedestrian image. According to the time sequence of each frame of pedestrian images in the walking sequence diagram, the stitched image corresponding to each frame of pedestrian images is video encoded to generate the target storage image.
7. The storage device according to claim 6, characterized in that, When the scaling module is used to scale the image size of the gait feature map, image background segmentation feature map, and face feature map corresponding to each frame of the walking sequence image, the scaling module is specifically used for: Obtain the preset size corresponding to each frame of the image; the preset size is the width or height of the image after scaling the gait feature map, image background segmentation feature map and face feature map corresponding to each frame of the pedestrian image. Based on the first actual size, the second actual size, and the preset size of the gait feature map, a first scaling size of the gait feature map is determined, and the gait feature map is scaled according to the preset size and the first scaling size; Based on the first actual size, the second actual size, and the preset size of the image background segmentation feature map, a second scaling size of the image background segmentation feature map is determined, and the image background segmentation feature map is scaled according to the preset size and the second scaling size; Based on the first actual size, the second actual size, and the preset size of the face feature map, a third scaling size of the face feature map is determined, and the image background segmentation feature map is scaled according to the preset size and the third scaling size.
8. An electronic device, characterized in that, include: The device includes a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus. The machine-readable instructions are executed by the processor to perform the steps of the method for storing pedestrian walking sequence diagrams as described in any one of claims 1 to 5.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the method for storing pedestrian walking sequence diagrams as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Video monitoring image data processing method and system
CN103826109A
Gait data acquisition and labeling method and application
CN112784740A