Method and device for detecting shielded area, and storage medium
By detecting target characteristics and similarities in video frames, it automatically identifies occluded areas, solving the problem of determining occluded areas in fixed camera shooting scenes, improving the accuracy of target recognition and tracking, and infers the location and travel route during occlusion.
Patent Information
- Application Number
- CN202310372794.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-10
- Publication Date
- 2024-10-15
AI Technical Summary
In video scenes captured by fixed cameras, it is difficult to determine the occlusion area, resulting in reduced target recognition and tracking accuracy, and the inability to effectively infer the target's location or route during occlusion.
By detecting multiple targets in the video frame, extracting target features, and determining whether it is an occluded pixel based on the similarity of target features near the pixel, the occluded area is generated. This method includes target detection, position determination, feature extraction and pixel classification. It uses YOLOX and OSNet models for target detection and feature extraction, and combines the floor layout map with automatic detection of occluded areas.
It achieves the accuracy of automatically detecting occluded areas in videos, improves the accuracy of inferring the target's position and travel route during occlusion, and reduces the adverse impact of occlusion on recognition and tracking.
Smart Images

Figure CN118781333A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure generally relates to the field of computer vision, and more specifically, to a method and apparatus for detecting occluded areas in a video, and a storage medium storing a corresponding program. Background Art
[0002] Occlusion is a common problem in the field of computer vision. For example, in the application of pedestrian recognition and tracking, if a pedestrian is blocked by an object (such as a tree or a building) in a part of the video, it is difficult to extract the pedestrian's features in this part of the video, and thus it is impossible to recognize and track the pedestrian. Therefore, the existence of occlusion usually reduces the accuracy and recall of target recognition, which has an adverse impact on practical applications.
[0003] In the case of shooting a scene with a fixed camera (such as a surveillance camera), in order to reduce the adverse effects of occlusion, the area blocked by obstacles in the scene shown in the video can be determined in advance, and then the position or movement trajectory of the target during the occluded period of time can be inferred using the information of the blocked area and other information (such as the target's movement speed and direction). For example, based on the time and position of the target disappearance and the time and position of the target reappearance, one or more possible routes of the target can be predicted. Then, based on the predetermined information of the blocked area, a route passing through the blocked area can be selected as an inference result with a higher confidence, and tracking can be performed based on this result.
[0004] In this case, there is the following technical problem: for a scene, especially a scene shot by a fixed camera, how to determine the area blocked by obstacles in the scene from the perspective of the camera. Summary of the invention
[0005] In view of the above technical problems, the present disclosure proposes a method and device for automatically detecting an occluded area in a scene shown in a video.
[0006] According to one aspect of the present disclosure, a method for detecting an occluded area in a video is provided, comprising: detecting multiple targets appearing in the video; determining the position of each of the multiple targets in a frame of the video; extracting features of each of the multiple targets; for each pixel in the frame, determining whether the pixel is an occluded pixel based on the similarity between features of targets near the pixel; and generating an occluded area based on multiple pixels in the frame determined to be occluded pixels.
[0007] According to another aspect of the present disclosure, a device for detecting an occluded area in a video is provided, comprising a memory storing a computer program and a processor, wherein the processor is configured to perform the following operations by executing the computer program: detecting multiple targets appearing in the video; determining the position of each of the multiple targets in a frame of the video; extracting features of each of the multiple targets; determining, for each pixel in the frame, whether the pixel is an occluded pixel based on the similarity between the features of targets near the pixel; and generating an occluded area based on multiple pixels in the frame determined to be occluded pixels.
[0008] According to another aspect of the present disclosure, a non-transitory computer-readable medium storing a program is provided. When the program is executed by a computer, the computer executes the above-mentioned method for detecting an obstructed area.
[0009] The technology of the present disclosure can automatically detect the area blocked by obstacles in the scene shown in the video. Therefore, when the target (such as a person) in the video cannot be identified and tracked due to being blocked, the position or route of the target during the blockage period can be inferred with high accuracy by using the information of the detected blocked area and the relevant information of the tracked target, thereby reducing the adverse effects of the blockage. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Figure 1 A flow chart of a method for detecting an occluded area according to the present disclosure is shown.
[0011] Figure 2 The functional modules for implementing the detection method according to the present disclosure are shown.
[0012] Figure 3 The plan layout diagram corresponding to the scene in the video is schematically shown.
[0013] Figure 4 The flow of a process for determining whether a pixel is an occluded pixel is shown.
[0014] Figure 5A and Figure 5B Detection results using the method according to the present disclosure are schematically shown.
[0015] Figure 6 An exemplary configuration block diagram of computer hardware for implementing the present disclosure is shown. DETAILED DESCRIPTION
[0016] Figure 1 A flow chart of a method for detecting an occluded area according to the present disclosure is shown. Figure 2The functional modules for implementing the detection method are shown.
[0017] like Figure 1 and Figure 2 As shown, in step S110, the target detection module 210 detects all targets appearing in the video. In the present disclosure, a target may refer to an object of interest that appears in the scene shown in the video, such as a person, a vehicle, etc. As a result of the target detection, one or more target frames may be generated, each of which surrounds a detected target. In particular, in the case where a portion of the target is blocked by an obstacle (e.g., a person's legs are blocked by a table), the target may still be detected, and the corresponding target frame will include the unblocked portion of the target (e.g., the upper body of the person) as well as the obstacle (e.g., a table).
[0018] In addition, any suitable known technology can be used to perform target detection, and the present disclosure is not limited to this. As an example, the YOLOX model is used to perform detection in the present disclosure. The YOLOX model is described in detail in the paper "Yolox: Exceeding yolo series" by Ge Z, Liu S, Wang F, et al., arXiv preprint arXiv:2107.08430, 2021, which is incorporated herein by reference.
[0019] In step S120, the position of each detected target in the video frame is determined by the position determination module 220. As an example, the position of the target may be based on the position of the midpoint of the bottom edge of the corresponding target frame.
[0020] In step S130, the features of each detected target are extracted by the feature extraction module 230. Any suitable known technique may be used to extract the features, for example, a person re-identification (Re-ID) technique may be used to extract the visual features of the target. As an example, an OSNet model is used in the present disclosure to extract the features of the target. The OSNet model is described in detail in the paper “Omni-scale feature learning for person re-identification” by K. Zhou, Y. Yang et al., ICCV, 2019, pp. 3702–3712, which is incorporated herein by reference.
[0021] In step S140 , for each pixel in a frame of the video, it is determined whether the pixel is an occluded pixel located in the occluded area according to the similarity between the features of the objects existing near the pixel. This step can be performed by the occluded pixel determination module 240 .
[0022] Specifically, if a pixel is not a pixel in the occluded area, then each of the multiple target frames near it is likely to contain only the target (e.g., a person), and the features of the person are different from each other, so the similarity between the features of each target frame is low. Conversely, if a pixel is a pixel in the occluded area, then each of the multiple target frames near it is likely to include both the target and the obstacle, the target parts in each target frame are different from each other, and the obstacle parts are similar to each other, so the similarity between the features of each target frame increases. Based on this, if the similarity between the features of each target frame near a pixel is high, the probability of the target being occluded near the pixel is high, so that the pixel is more likely to be in the occluded area in the scene shown in the video.
[0023] The determination in step S140 may be performed for all pixels in the video frame. Then, the occluded region generation module 250 generates an occluded region based on a plurality of pixels in the frame determined to be occluded pixels, as shown in step S150.
[0024] It should be noted that the method according to the present disclosure is not limited to Figure 1 The steps of step S120 and step S130 are not necessarily the same as those shown in the above description, but may be performed in a different order. For example, step S120 may also be performed after step S130, or may be performed in parallel with step S130.
[0025] As an alternative embodiment, when Figure 1 After the position of each detected target in the video frame has been determined in step S120, the position can be further mapped to a floor plan corresponding to the scene shown in the video, and the floor plan can be prepared in advance. For example, when the scene involved in the video is a supermarket, a pre-prepared floor plan of the supermarket can be used.
[0026] Figure 3 The floor plan of a supermarket is schematically shown, wherein the black parts represent obstacles such as shelves, pillars, and walls, and the white parts represent areas where people can pass.
[0027] It should be noted that since a camera usually does not cover the entire range of a supermarket, the scene involved in a video may only correspond to a part of the floor plan. Figure 3 As schematically shown, targets A, B, C detected in one video and targets D and E detected in another video are all mapped into the floor plan.
[0028] Then, with Figure 1Similarly, for each pixel in the planar layout diagram, it can be determined whether there is a detected target near the pixel, and based on the similarity between the features of the targets near the pixel, it can be determined whether the pixel is an occluded pixel.
[0029] Figure 4 A specific process for determining whether a pixel is an occluded pixel is shown, which can be applied in combination with Figure 1 Each pixel in the video frame described can also be applied to the combination of Figure 3 Each pixel in the described floor plan.
[0030] like Figure 4 As shown, in step S410, for each pixel (x, y) in a video frame or a floor plan containing a plurality of detected targets, targets (hereinafter referred to as "neighboring targets") that exist within a range where the distance from the pixel (x, y) is less than a first threshold are determined. More specifically, the distance from the pixel (x, y) may be the distance between the position of the midpoint of the bottom edge of the target frame and the position of the pixel (x, y). As an example, the distance from the pixel (x, y) may be in pixels, and the first threshold may be 10 pixels.
[0031] In step S420, it is checked whether the number of neighboring targets determined in step S410 is too few or too many. Specifically, when the number of neighboring targets determined is less than the fourth threshold, it can be directly determined that the pixel (x, y) is not an occluded pixel. When the number of neighboring targets determined is greater than the fifth threshold, neighboring targets with a number equal to the fifth threshold can be selected from them, and redundant neighboring targets can be discarded. As an example, the fourth threshold can be 5, and the fifth threshold can be 1000.
[0032] Then, in step S430, the similarity between the features of any two neighboring objects among the determined or selected multiple neighboring objects is calculated, thereby generating a similarity set. As an example, the cosine similarity between the features is calculated in the present disclosure.
[0033] In step S440, the number of similarities in the similarity set that are greater than a second threshold is determined, and the ratio of the number of these relatively large similarities to the total number of all similarities is calculated. As an example, the second threshold may be 0.6.
[0034] In step S450, the determined ratio is compared with a third threshold. When the ratio is greater than the third threshold, it can be determined that the pixel (x, y) is an occluded pixel. When the ratio is not greater than the third threshold, it can be determined that the pixel (x, y) is not an occluded pixel. As an example, the third threshold can be 0.3.
[0035] Can be performed on all pixels in a video frame or floor plan Figure 4 The process shown is used to determine whether each pixel is an occluded pixel.
[0036] When multiple occluded pixels have been determined in a video frame or a floor plan, outlier pixels can be deleted from the set of occluded pixels, and then the remaining pixels are dilated to generate an occluded area ( Figure 1 Those skilled in the art may use any appropriate known technology to delete outlier pixels and perform dilation processing, and the present disclosure does not limit this.
[0037] Figure 5A and Figure 5B The results of detecting occluded areas for two videos using the method according to the present disclosure are schematically shown. Video 1 and Video 2 are related to the same supermarket (same floor plan) and are shot by different cameras.
[0038] Figure 5A (a) and Figure 5B The grey shading in (a) represents the area in the supermarket that can be captured by the camera.
[0039] In addition, since the blocked areas detected by the method of the present disclosure are relatively scattered, in order to display the results more clearly, Figure 5A (b) and Figure 5B In (b), the non-occluded area is shown in gray shading, where the non-occluded area is obtained by subtracting the occluded area detected by the method according to the present disclosure from the valid area of the scene. In addition, Figure 5A (a) and Figure 5B In (a), the non-occluded area marked manually is shown in a box. It can be seen that the manually marked area is regular but not fine enough, while the detection result of the present disclosure can effectively cover the manually marked area and is more fine.
[0040] The above has described the technology according to the content of the present disclosure in conjunction with the specific embodiments, and the technology can be used to automatically detect the area blocked by obstacles in the scene shown in the video. As mentioned above, if the target (such as a person) in the video cannot be identified and tracked due to being blocked, the information of the blocked area in the detected scene and the relevant information of the tracked target can be used to infer the position or route of the target during the blockage with high accuracy, thereby reducing the adverse effects of the blockage.
[0041] The methods described in the above embodiments can be implemented by software, hardware, or a combination of software and hardware. The programs included in the software can be pre-stored in a storage medium provided inside or outside the device. As an example, during execution, these programs are written to a random access memory (RAM) and executed by a processor (e.g., CPU), thereby implementing the various methods and processes described in this article.
[0042] Figure 6 The block diagram shows an example configuration of computer hardware that executes the method of the present disclosure according to a program. The apparatus for detecting an obstructed area according to the present disclosure can be implemented based on the computer hardware.
[0043] like Figure 6 As shown, in a computer 600 , a central processing unit (CPU) 601 , a read only memory (ROM) 602 , and a random access memory (RAM) 603 are connected to one another via a bus 604 .
[0044] The input / output interface 605 is further connected to the bus 604. The input / output interface 605 is connected with the following components: an input device 606 formed of a keyboard, a mouse, a microphone, etc.; an output device 607 formed of a display, a speaker, etc.; a storage device 608 formed of a hard disk, a nonvolatile memory, etc.; a communication device 609 formed of a network interface card (such as a local area network (LAN) card, a modem, etc.); and a drive 610 for driving a removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory.
[0045] In the computer having the above-described structure, the CPU 601 loads the program stored in the storage device 608 into the RAM 603 via the input / output interface 605 and the bus 604 and executes the program so as to perform the method described above.
[0046] The program to be executed by the computer (CPU 601) may be recorded on a removable medium 611 as a package medium, which is formed of, for example, a magnetic disk (including a floppy disk), an optical disk (including a compact disc-read only memory (CD-ROM)), a digital versatile disc (DVD), etc.), a magneto-optical disk, or a semiconductor memory. In addition, the program to be executed by the computer (CPU 601) may also be provided via a wired or wireless transmission medium such as a local area network, the Internet, or digital satellite broadcasting.
[0047] When the removable medium 611 is mounted in the drive 610, the program can be installed in the storage device 608 via the input / output interface 605. In addition, the program can be received by the communication device 609 via a wired or wireless transmission medium and installed in the storage device 608. Alternatively, the program can be pre-installed in the ROM 602 or the storage device 608.
[0048] The program executed by the computer may be a program that performs processing according to the sequence described in this specification, or may be a program that performs processing in parallel or performs processing when necessary such as when called.
[0049] The modules or devices described herein are only in a logical sense and do not strictly correspond to physical devices or entities. For example, the functions of each module described herein may be implemented by multiple physical entities, or the functions of multiple modules described herein may be implemented by a single physical entity. In addition, the features, components, elements, steps, etc. described in one embodiment are not limited to the embodiment, but may also be applied to other embodiments, such as replacing specific features, components, elements, steps, etc. in other embodiments, or combining them.
[0050] The scope of the present disclosure is not limited to the specific embodiments described herein. It should be understood by those skilled in the art that, depending on design requirements and other factors, various modifications or changes may be made to the embodiments herein without departing from the principles and spirit of the present disclosure. The scope of the present disclosure is defined by the appended claims and their equivalents.
[0051] In addition, the present disclosure also includes the following embodiments.
[0052] (1) A method for detecting an occluded area in a video, comprising:
[0053] Detect multiple objects appearing in a video;
[0054] determining a position of each of the plurality of objects in a frame of the video;
[0055] extracting features of each of the plurality of objects;
[0056] For each pixel in the frame, determining whether the pixel is an occluded pixel according to similarities between features of objects near the pixel;
[0057] An occluded region is generated based on a plurality of pixels in the frame determined to be occluded pixels.
[0058] (2) The method according to (1), further comprising:
[0059] Mapping the position of each object in the frame to a floor plan corresponding to a scene in the video;
[0060] For each pixel in the plan layout image, determining whether the pixel is an occluded pixel according to the similarity between the features of the objects near the pixel;
[0061] A plurality of pixels in the plan layout image that are determined to be blocked pixels are processed to generate a blocked area.
[0062] (3) The method according to (1) or (2), further comprising: for each pixel in the frame or the planar layout,
[0063] determining a plurality of neighboring objects whose distances from the pixel are less than a first threshold,
[0064] Calculating the similarity between the features of any two neighboring targets among the plurality of neighboring targets to generate a similarity set;
[0065] calculating a ratio of the number of similarities greater than a second threshold to the total number of similarities in the similarity set;
[0066] When the ratio is greater than a third threshold, it is determined that the pixel is an occluded pixel.
[0067] (4) The method according to (3), further comprising:
[0068] When the determined number of neighboring objects is less than a fourth threshold, directly determining that the pixel is not an occluded pixel;
[0069] In the case where the number of determined neighboring targets is greater than the fifth threshold, selecting neighboring targets whose number is the fifth threshold, and calculating the similarity between the features of the selected neighboring targets,
[0070] Among them, the fourth threshold is smaller than the fifth threshold.
[0071] (5) The method according to (3), wherein the similarity is cosine similarity.
[0072] (6) The method according to (1) or (2), further comprising:
[0073] For a set consisting of a plurality of pixels determined to be occluded pixels, outlier pixels in the set are deleted, and a dilation process is performed on the remaining pixels to generate an occluded area.
[0074] (7) The method according to (1), wherein the features of the target are extracted using pedestrian re-identification technology.
[0075] (8) The method according to (3), wherein the distance between the pixel and the neighboring target is in pixels.
[0076] (9) A device for detecting an occluded area in a video, comprising:
[0077] a memory storing a computer program; and
[0078] A processor, the processor being configured to perform the following operations by executing the computer program:
[0079] Detect multiple objects appearing in a video;
[0080] determining a position of each of the plurality of objects in a frame of the video;
[0081] extracting features of each of the plurality of objects;
[0082] For each pixel in the frame, determining whether the pixel is an occluded pixel according to similarities between features of objects near the pixel;
[0083] An occluded region is generated based on a plurality of pixels in the frame determined to be occluded pixels.
[0084] (10) According to the apparatus described in (9), the processor is further configured to:
[0085] Mapping the position of each object in the frame to a floor plan corresponding to a scene in the video;
[0086] For each pixel in the plan layout image, determining whether the pixel is an occluded pixel according to the similarity between the features of the objects near the pixel;
[0087] A plurality of pixels in the plan layout image that are determined to be blocked pixels are processed to generate a blocked area.
[0088] (11) According to the apparatus of claim (9) or (10), the processor is further configured to: for each pixel in the frame or the planar layout,
[0089] determining a plurality of neighboring objects whose distances from the pixel are less than a first threshold,
[0090] Calculating the similarity between the features of any two neighboring targets among the plurality of neighboring targets to generate a similarity set;
[0091] calculating a ratio of the number of similarities greater than a second threshold to the total number of similarities in the similarity set;
[0092] When the ratio is greater than a third threshold, it is determined that the pixel is an occluded pixel.
[0093] (12) According to the apparatus described in (11), the processor is further configured to:
[0094] When the determined number of neighboring objects is less than a fourth threshold, directly determining that the pixel is not an occluded pixel;
[0095] In the case where the number of determined neighboring targets is greater than the fifth threshold, selecting neighboring targets whose number is the fifth threshold, and calculating the similarity between the features of the selected neighboring targets,
[0096] Among them, the fourth threshold is smaller than the fifth threshold.
[0097] (13) The apparatus according to (11), wherein the similarity is cosine similarity.
[0098] (14) According to the apparatus described in (9) or (10), the processor is further configured to:
[0099] For a set consisting of a plurality of pixels determined to be occluded pixels, outlier pixels in the set are deleted, and a dilation process is performed on the remaining pixels to generate an occluded area.
[0100] (15) The device according to (9), wherein the features of the target are extracted using pedestrian re-identification technology.
[0101] (16) The apparatus according to (11), wherein the distance between the pixel and the neighboring target is in pixels.
[0102] (17) A non-transitory computer-readable medium storing a program, wherein when the program is executed by a computer, the computer executes the method for detecting an occluded area in a video according to (1) to (8).
Claims
1. A method for detecting an occluded area in a video, comprising: Detect multiple objects appearing in a video; determining a position of each of the plurality of objects in a frame of the video; extracting features of each of the plurality of objects; For each pixel in the frame, determining whether the pixel is an occluded pixel according to similarities between features of objects near the pixel; An occluded region is generated based on a plurality of pixels in the frame determined to be occluded pixels.
2. The method according to claim 1, further comprising: Mapping the position of each object in the frame to a floor plan corresponding to a scene in the video; For each pixel in the plan layout image, determining whether the pixel is an occluded pixel according to the similarity between the features of the objects near the pixel; A plurality of pixels in the plan layout image that are determined to be blocked pixels are processed to generate a blocked area.
3. The method according to claim 1 or 2, further comprising: For each pixel in the frame or the floor plan, determining a plurality of neighboring objects whose distances from the pixel are less than a first threshold, Calculating the similarity between the features of any two neighboring targets among the plurality of neighboring targets to generate a similarity set; calculating a ratio of the number of similarities greater than a second threshold to the total number of similarities in the similarity set; When the ratio is greater than a third threshold, it is determined that the pixel is an occluded pixel.
4. The method according to claim 3, further comprising: When the determined number of neighboring objects is less than a fourth threshold, directly determining that the pixel is not an occluded pixel; In the case where the number of determined neighboring targets is greater than the fifth threshold, selecting neighboring targets whose number is the fifth threshold, and calculating the similarity between the features of the selected neighboring targets, Among them, the fourth threshold is smaller than the fifth threshold.
5. The method according to claim 3, wherein: The similarity is cosine similarity.
6. The method according to claim 1 or 2, further comprising: For a set consisting of a plurality of pixels determined to be occluded pixels, outlier pixels in the set are deleted, and a dilation process is performed on the remaining pixels to generate an occluded area.
7. The method according to claim 1, wherein: The features of the target are extracted using person re-identification technology.
8. The method according to claim 3, wherein: The distance between the pixel and the neighboring object is in pixels.
9. A device for detecting an occluded area in a video, comprising: a memory storing a computer program; as well as A processor, the processor being configured to perform the following operations by executing the computer program: Detect multiple objects appearing in a video; determining a position of each of the plurality of objects in a frame of the video; extracting features of each of the plurality of objects; For each pixel in the frame, determining whether the pixel is an occluded pixel according to similarities between features of objects near the pixel; An occluded region is generated based on a plurality of pixels in the frame determined to be occluded pixels. 10 . A non-transitory computer-readable medium storing a program, wherein when the program is executed by a computer, the computer performs the method for detecting an occluded area in a video according to any one of claims 1 to 8 .
Citation Information
Patent Citations
Image detection device and method thereof
CN101909143A
Target detection method, image processing equipment and equipment with storage function
CN110321806A
Multi-target tracking method, device, electronic equipment and storage medium
CN113628245A
