Image reasoning method and device, computer equipment and readable storage medium

By performing attribute inference only when specific conditions are met in video stream image processing, the problem of repeated inference of image frames in video streams is solved, processing efficiency is improved and computing resources are saved.

CN118587453APending Publication Date: 2024-09-03MAIPU COMM TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310193709.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-02
Publication Date
2024-09-03

AI Technical Summary

Technical Problem

The existing technology has repeated reasoning in video stream image processing, resulting in low efficiency and increased calculations. Especially after object detection, attribute reasoning needs to be performed on each frame of image. Although the relevant attribute reasoning has been completed in a certain frame, subsequent frames will not be able to perform attribute reasoning. Still need to repeat the reasoning.

Method used

Object detection and tracking are performed by obtaining the image frames of the video stream, and the metadata of the object is obtained. Based on the object ID in the metadata, it is judged whether the preset inference conditions are met. Attribute inference is only performed when the conditions are met, otherwise the inference process is skipped.

Benefits of technology

It avoids repeated inference of the same image frame, saves processing resources, improves image inference efficiency, and optimizes the utilization of object metadata through the caching mechanism to reduce the demand for hardware resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118587453A
    Figure CN118587453A
Patent Text Reader

Abstract

The invention provides an image reasoning method and device, computer equipment and a readable storage medium. The method comprises the following steps: acquiring an image frame of a video stream; performing object detection and tracking on the image frame to obtain metadata of an object; the metadata at least comprises an object ID; judging whether the image frame meets a preset reasoning condition or not according to the object ID; wherein the preset reasoning condition is any one of the following conditions: no cached object ID exists; the cached object ID is invalid; the cached object ID is effective, and the metadata corresponding to the object ID has missing attributes; if yes, performing attribute reasoning on the image frame; otherwise, not carrying out attribute reasoning on the image frame. According to the invention, attribute reasoning is carried out on the image frame only when the image frame meets the preset reasoning condition, so that the phenomenon of repeated reasoning of the same image frame is avoided, processing data can be saved, and reasoning efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of image processing, and specifically, to an image reasoning method, apparatus, computer equipment, and readable storage medium. Background Art

[0002] Artificial Intelligence (AI) technology can detect objects through neural network models. After detecting an object, it is necessary to infer the object's attributes and improve the object's attribute metadata to process related business logic. For example, in the process of detecting license plates at intersections, all vehicles can be detected first, and then license plate recognition and vehicle model recognition can be performed based on the detected vehicles.

[0003] In actual scenarios, object detection is usually performed on video streams. Existing technologies extract multiple frames of images and perform attribute inference on each frame. In this way, although the relevant attribute inference has been completed in a certain frame, it is still necessary to waste processing data in subsequent frames, resulting in repeated inference, low efficiency, and increased computational effort. Summary of the invention

[0004] One of the purposes of the present invention is to provide an image reasoning method, apparatus, computer equipment and readable storage medium for saving processing data and improving image reasoning efficiency. The embodiments of the present invention can be implemented as follows:

[0005] In a first aspect, the present invention provides an image reasoning method, the method comprising: acquiring an image frame of a video stream; performing object detection and tracking on the image frame to obtain metadata of the object; the metadata comprising at least an object ID; judging whether the image frame satisfies a preset reasoning condition based on the object ID; wherein the preset reasoning condition is any one of the following: the object ID that has been cached does not exist; the object ID that has been cached is invalid; the object ID that has been cached is valid and there are missing attributes in the metadata corresponding to the object ID; if so, performing attribute reasoning on the image frame; otherwise, not performing attribute reasoning on the image frame.

[0006] In a second aspect, the present invention provides an image reasoning device, comprising: an acquisition module, used to acquire image frames of a video stream; a detection module, used to perform object detection and tracking on the image frames, and obtain metadata of the object; the metadata at least includes an object ID; a judgment module, used to judge whether the image frame meets a preset reasoning condition based on the object ID, wherein the preset reasoning condition is any one of the following: the cached object ID does not exist; the cached object ID is invalid; the cached object ID is valid and there is a missing attribute in the metadata corresponding to the object ID; and an reasoning module, used to perform attribute reasoning on the image frame when the judgment module judges that the preset reasoning condition is met.

[0007] In a third aspect, the present invention provides a computer device, comprising a processor and a memory, wherein the memory stores a computer program executable by the processor, and the processor can execute the computer program to implement the image reasoning method as described in the first aspect.

[0008] In a fourth aspect, the present invention provides a readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the image reasoning method as described in the first aspect.

[0009] Compared with the prior art, the present invention provides an image reasoning method, apparatus, computer equipment and readable storage medium, which detect and track objects by acquiring image frames of a video stream to obtain metadata of the object, and determine whether the image frame meets preset reasoning conditions based on the object ID in the metadata. If so, attribute reasoning is performed on the image frame, otherwise, attribute reasoning is not performed on the image frame. That is to say, the present invention performs attribute reasoning on the image frame only if the image frame meets the preset reasoning conditions, avoiding the phenomenon of repeated reasoning on the same image frame, thereby saving processing data and improving reasoning efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0011] Figure 1 A schematic diagram of a common image reasoning scheme;

[0012] Figure 2 A schematic diagram of an application scenario is shown;

[0013] Figure 3A schematic diagram of the principle of the image reasoning method provided by an embodiment of the present invention;

[0014] Figure 4 A schematic flow chart of an image reasoning method provided by an embodiment of the present invention;

[0015] Figure 5 A schematic flow chart of step S303 provided in an embodiment of the present invention;

[0016] Figure 6 A functional module diagram of an image reasoning device provided by an embodiment of the present invention;

[0017] Figure 7 A structural block diagram of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0018] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.

[0019] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0020] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0021] In the description of the present invention, it should be noted that if the terms "upper", "lower", "inside", "outside", etc. appear to indicate an orientation or position relationship, they are based on the orientation or position relationship shown in the accompanying drawings, or are the orientation or position relationship in which the product of the invention is usually placed when used. They are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention.

[0022] In addition, the terms “first”, “second”, etc., if used, are merely used to distinguish between the descriptions and should not be understood as indicating or implying relative importance.

[0023] It should be noted that, in the absence of conflict, the features in the embodiments of the present invention may be combined with each other.

[0024] At present, the AI ​​field can perform object detection through neural network models. In actual scenarios, object detection is performed by converting each frame of the video stream into an image for reasoning. The reasoning process is generally: first detect whether there is an object in the image frame, and then perform secondary reasoning on the detected object to improve its properties. For example, in the process of license plate detection at an intersection, the image is first reasoned for the first time to identify all vehicles and their locations, and then secondary reasoning is performed based on the detected vehicles to perform license plate recognition, vehicle model, etc.

[0025] like Figure 1 As shown, Figure 1 The figure is a schematic diagram of a common image reasoning scheme, where Frames represents image frames; Model 1, Model 2, and Model 3 represent reasoning models respectively, where Model 1 is used for one-stage reasoning to complete object recognition, and Model 2 and Model 3 are used for two-stage reasoning to complete attribute metadata completion. It should be noted that the reasoning model used for two-stage reasoning can have multiple attributes, and the number is not limited.

[0026] Figure 1 The main idea of ​​the image reasoning scheme shown is: use a video acquisition device to capture the video stream, and pass each frame of the video stream through Model 1, Model 2 and Model 3 in turn for attribute reasoning to obtain the attribute metadata of the object in each frame, or, extract the frame of the video stream, and then pass each extracted frame through the above three models in turn for attribute reasoning. The frame extraction method is not limited, and it can be one frame extracted every two frames, or one frame extracted every three frames.

[0027] It can be seen that in the above-mentioned image reasoning scheme, one frame of image needs to be repeatedly processed by multiple reasoning models, and the same image frame will inevitably be repeatedly reasoned, wasting reasoning resources. When the reasoning attributes are fixed, the more reasoning AI modules there are, the lower the processing speed. Moreover, even if the attributes of the object have been perfected in a certain image frame, it is still necessary to waste reasoning data for reasoning in subsequent image frames, resulting in low image reasoning efficiency.

[0028] In order to solve the above technical problems, improve the inference efficiency, and save hardware resource overhead, the present invention provides an improved image inference solution. The main idea of ​​the solution is: if all objects and their attributes detected in the image frame are complete, then there is no need to perform AI inference on the image frame and skip the image. On the contrary, the missing parts of the relevant objects and their attributes are completed, so that the same image frame can be avoided from being repeatedly inferred, which can maximize the saving of computing workload and improve efficiency. The following is a detailed introduction.

[0029] Before introducing the specific implementation of the embodiment of the present invention, a possible application scenario is first introduced. Figure 2 , Figure 2 A schematic diagram of an application scenario is shown, including at least one video acquisition device and a computer device, and each video acquisition device is communicatively connected to the computer device.

[0030] The video acquisition device may be, but is not limited to, a camera, a camera module, etc. The video acquisition device is used to acquire video streams and transmit them to a computer device. In practical applications, the video acquisition device may be installed at intersections, stations, access control points, etc., and the embodiments of the present invention do not impose any restrictions on this.

[0031] The computer device has an image processing function, and may be a server, a personal computer, an edge gateway, etc. The computer device is used to obtain the video stream transmitted by the video acquisition device, and quickly complete the attribute reasoning of the object according to the image reasoning method provided by the embodiment of the present invention.

[0032] In practical applications, there are usually multiple video acquisition devices connected to computer equipment, especially edge gateways and other products, which need to access multiple video streams at the same time, for example, 16 cameras. Obviously, the computer equipment needs to detect the video streams transmitted by the multiple video acquisition devices. If the existing object detection method is used, the detection amount of the computer equipment will be very large, and there will be a large number of repeated detections in each video stream, which seriously wastes hardware processing resources and time.

[0033] Therefore, from the perspective of practical application, in order to save hardware processing resources, in the embodiment of the present invention, the AI ​​chip of the computer device performs image processing tasks, such as target detection and tracking of the video stream. At the same time, the CPU of the computer device detects whether the image frame meets the preset reasoning conditions and image reasoning optimization processing provided later in the embodiment of the present application.

[0034] In addition, considering the actual business detection scenarios, such as the detection object is a vehicle, a person or other objects, different business detection scenarios can correspond to different video acquisition devices. For example, the video stream collected by one video acquisition device is used for vehicle detection, and the video stream collected by another video acquisition device is used for detecting people. Then, the AI ​​chip of the computer device can include multiple one-stage reasoning modules, such as Figure 1 In Model 1 shown in the figure, each video acquisition device can correspond to a one-stage reasoning module, which is used to complete target detection and tracking and determine the location information, ID and other metadata of the object.

[0035] In this way, the CPU and AI chip of the computer device cooperate with each other, and the insufficient computing power of the AI ​​chip is compensated by the CPU computing power, which reduces the demand for the hardware performance of the device and effectively saves hardware processing resources, so that more video streams can be connected.

[0036] exist Figure 2 Based on Figure 3 , Figure 3 The schematic diagram of the image reasoning method provided in the embodiment of the present invention is as follows: in order to improve the efficiency of image reasoning, the video stream collected by the video acquisition device will first pass through Model 1 for one-stage reasoning to complete target detection and tracking, and determine the location information, ID and other metadata of the object. The detected object will be assigned an object ID and the duration of the object ID. The attributes of the object will also be assigned a duration. If the cache duration of the object ID and its corresponding attributes is within the duration, the object ID and its attributes can be continuously used during this period; otherwise, the object ID and its corresponding attributes need to be updated, and the object ID will be cleared if it is not updated for a long time.

[0037] The computer device also includes multiple two-stage reasoning models, such as Figure 1 In Model 2 and Model 3, each preset attribute corresponds to a two-stage reasoning model. For example, the license plate and vehicle model can be inferred using different two-stage reasoning models respectively.

[0038] In an embodiment of the present invention, if the object ID detected in the current image frame has been cached and the attributes are complete, the current image frame is skipped without going through Model 2 and Model 3 for two-stage reasoning, and the frame is directly processed; conversely, if there is no valid cached object ID or the object ID is invalid, the current image frame is respectively passed through Model 2 and Model 3 for two-stage reasoning, but in the actual implementation process, this situation will not occur, because the embodiment of the present application can ensure the valid existence of the object ID in the last judgment process, or, if there are missing attributes in the cached valid object ID, then the image frame is reasoned through the two-stage reasoning model corresponding to the missing attributes to complete the attribute completion. For example, if the attributes corresponding to Model 2 are indeed present, the current image frame is subjected to two-stage reasoning through Model 2, and the attributes corresponding to Model 3 are missing, then the current image frame is subjected to two-stage reasoning through Model 3. If both are missing, the current image frame is subjected to two-stage reasoning through Model 2 and Model 3 respectively.

[0039] For example, if the object is a vehicle and the vehicle lacks license plate information and vehicle type information, the inference model corresponding to the license plate is used to infer the image frame to obtain the license plate information, and the inference model corresponding to the vehicle type information is used to infer the image frame to obtain the vehicle type information. If the vehicle attributes are complete, there is no need to use any two-stage inference model for subsequent inference, which reduces the amount of inference calculation. At the same time, the result of one inference can be reused multiple times to improve the utilization rate of each inference.

[0040] The following takes a video acquisition device as an example to introduce the image reasoning method provided by the embodiment of the present invention in detail.

[0041] See also Figure 4 , Figure 4 A schematic flow chart of an image reasoning method provided by an embodiment of the present invention, the method is applied to Figure 2 In the computer device in the embodiment, the following steps may be included:

[0042] Step S401: Acquire image frames of a video stream.

[0043] In an embodiment of the present invention, a video acquisition device acquires video in real time and transmits the video stream to a computer device. The computer device performs frame extraction on the video stream to obtain multiple image frames. The frame extraction method is not limited here. Alternatively, each frame of the video stream is directly used as an image frame.

[0044] Step S402: performing object detection and tracking on the image frame to obtain metadata of the object; the metadata at least includes the object ID.

[0045] In an embodiment of the present invention, the computer device needs to perform object detection and tracking on each extracted image frame to obtain the object ID present in each image frame. The object may be a vehicle, a person, or other identifiable object. The metadata may include the object ID, the location information of the object, and the image frame. For example, if the object is a vehicle, the metadata may include the vehicle ID, location, image, and other information.

[0046] Step S403: judging whether the image frame meets a preset reasoning condition according to the object ID.

[0047] The preset inference condition is any one of the following: there is no cached object ID; the cached object ID is invalid; there is a missing attribute in the metadata corresponding to the cached and valid object ID.

[0048] In an embodiment of the present invention, the computer device caches the metadata of all detected objects, and then determines whether the current image frame needs to perform two-stage reasoning based on the cached metadata. If the current image frame meets any of the following conditions, the image frame needs to perform secondary reasoning to improve the attributes, otherwise the image frame will not be reasoned.

[0049] Condition 1: There is no cached object ID.

[0050] It is understandable that if the object ID corresponding to the current image frame has not been cached before, it means that the object ID corresponds to a new object, and the current image frame needs to be inferred.

[0051] Condition 2: The cached object ID is invalid.

[0052] The embodiment of the present invention sets a duration in advance for each object ID in the cache to determine whether the cached object ID is valid. If it is invalid, it is necessary to infer the current image frame.

[0053] Condition 3: The cached object ID is valid and the metadata corresponding to the object ID has missing attributes.

[0054] In an embodiment of the present invention, after determining that the object ID has been cached and is valid, it is further determined whether there are missing attributes in the metadata of the object ID. For example, if the metadata of the vehicle ID contains location information but lacks the license plate and vehicle type, it is necessary to infer the current image frame to obtain the license plate and vehicle type.

[0055] Step S404: if satisfied, attribute inference is performed on the image frame;

[0056] Step S405: If not satisfied, no attribute inference is performed on the image frame.

[0057] The above step S403 is described in detail below.

[0058] In an alternative embodiment, Figure 4 Based on Figure 5 , Figure 5 The schematic flow chart of step S403 provided for the implementation of the present invention, in the process of determining whether the image frame meets the preset reasoning condition, can first determine whether the object ID corresponding to the image frame is previously cached, determine whether the object ID is valid under the condition that the object ID is cached, and determine whether there is a missing attribute in the cached metadata under the condition that the object ID is valid. Therefore, step S403 can include:

[0059] S403-1: If there is a cached object ID, determine whether the cache duration of the object ID is greater than a preset duration.

[0060] In an embodiment of the present invention, the duration can be set according to actual business needs, such as 1 second, 5 seconds, 60 seconds, etc., which is not limited here. The cache duration can be determined based on the timestamp when the object ID is cached and the current timestamp.

[0061] S403-2: If it is greater than, it is determined that the cached object ID is invalid and the image frame meets the preset reasoning condition.

[0062] S403-3: If it is less than or equal to, determine whether there is a missing attribute in the metadata whose object ID has been cached.

[0063] S403-4: If yes, determine that the image frame meets the preset reasoning condition.

[0064] S403-5: If not, determine that the image frame does not meet the preset reasoning condition.

[0065] S403 - 6 : If there is no cached object ID, determine that the image frame meets the preset reasoning condition.

[0066] It should be noted that the above implementation is merely an example. In other implementations, it is possible to first determine whether the object ID is valid and then determine whether there are missing attributes in the metadata cached by the object ID. It is also possible to first determine whether the object ID has missing attributes and then determine whether the object ID is valid. This is not limited here.

[0067] Optionally, after determining that the image frame meets the preset reasoning condition, it is necessary to perform attribute reasoning on the image frame to improve the attribute metadata of the object ID. Therefore, the above step S404 may be performed as follows:

[0068] Step 1: If there is no cached object ID, or the cached object ID is invalid, then obtain the inference model corresponding to each attribute, and use each inference model to perform attribute inference on the image frame respectively.

[0069] Step 2: If there are missing attributes in the metadata corresponding to the cached and valid object ID, obtain the inference model corresponding to the missing attribute, and use the inference model corresponding to the missing attribute to perform attribute inference on the image frame.

[0070] That is to say, in an embodiment of the present invention, assuming that there is no cached object ID before or the object ID has expired, both the object and the attributes need to be updated, that is, the image frame is input into the reasoning model corresponding to each attribute to obtain the attribute information of each attribute. Assuming that there is a valid object ID, the image frame only needs to be processed with the reasoning model corresponding to the missing attribute to obtain the attribute information of the missing attribute.

[0071] Optionally, after performing attribute inference on the image frame, the inferred attribute information needs to be cached for subsequent image reasoning. For example, if a vehicle ID has not been cached before or has expired, then after obtaining the license plate, vehicle type and other attribute information corresponding to the vehicle ID through attribute inference, the vehicle ID, license plate, vehicle type and other attribute information are cached as the metadata corresponding to the vehicle. At the same time, the corresponding duration of each attribute information needs to be updated.

[0072] Therefore, if there is no cached object ID, the object ID is set to a duration, and the object ID and the newly inferred attribute information are cached.

[0073] It is understandable that if there is a valid object ID that has been cached, the attribute information of the new inference processing can be directly cached.

[0074] Optionally, it is known from the above implementation that each cached object ID and its corresponding attribute information are set with a duration, and the object ID and its attributes can be continuously used within the corresponding duration, otherwise the object ID or the attribute information corresponding to the object ID is deleted. For example, if the cache duration of the object ID exceeds the duration, the attribute of the object ID needs to be updated, and the object ID that has not been updated for a long time will be cleared from the cache. If the cache duration of the attribute information corresponding to the object ID exceeds the duration, the attribute needs to be updated. Therefore, when the time difference between the cache duration of the object ID and the duration exceeds the preset time difference, the cache corresponding to the object ID is deleted.

[0075] Optionally, in the embodiment of the present invention, the object attributes include: attribute information of dynamic attributes and attribute information of static attributes, wherein the dynamic attributes need to be refreshed regularly, such as: coordinates, masks (put on or take off); static attributes will not change once acquired, such as license plates, car models, etc. Therefore, regardless of whether the current image frame needs to perform two-stage reasoning, the dynamic attributes of the objects in it need to be refreshed. Therefore, the embodiment of the present invention provides an implementation method, namely:

[0076] According to the preset update frequency, the cached historical attribute information corresponding to the dynamic attribute is updated using the new attribute information of the dynamic attribute corresponding to the object ID in the metadata, and an update mark is configured for the updated dynamic attribute.

[0077] The above implementation method can periodically update the dynamic attributes to ensure the timeliness of the dynamic attributes.

[0078] In an actual business process, there may be multiple objects, and each object needs to complete its attribute information. Therefore, in order to implement the image reasoning method provided in an embodiment of the present invention, the metadata of all objects can be pushed to a message queue, for example, a Redis (Remote Dictionary Server) message queue, and then the metadata is obtained from the message queue for message screening to determine whether two-stage reasoning is required.

[0079] Optionally, the completed or updated attribute information can trigger the relevant event processing business logic. For example, after the coordinates are updated, it will be checked whether it has entered the restricted area, and after the face detection is updated, it will be checked whether it is a stranger.

[0080] In summary, in the image reasoning method provided above, the computer device first obtains an image frame, and performs object detection and tracking on the image frame, determines the object ID corresponding to the object in the image frame, and then determines whether the image frame meets the preset reasoning condition according to the object ID. If the condition is satisfied, attribute reasoning is performed on the image frame, and if not, attribute reasoning is not performed on the image frame. Compared with the prior art, the embodiment of the present invention has the following beneficial effects:

[0081] First, attribute reasoning is performed on the image frame only when the image frame meets the preset reasoning conditions. Otherwise, attribute reasoning is not required, which avoids repeated reasoning on the same image frame, thereby saving processing data and improving reasoning efficiency.

[0082] Secondly, by caching the metadata of the identified objects, it is possible to associate the currently detected object with the previously cached object, so as to quickly identify whether the current image frame needs attribute reasoning, and at the same time reuse the reasoning result multiple times to improve the utilization rate of each reasoning.

[0083] Finally, the CPU and AI chip of the computer device cooperate with each other, and the CPU computing power makes up for the lack of AI chip computing power, reducing the demand for device hardware performance and effectively saving hardware processing resources, so that more video streams can be connected.

[0084] Based on the same inventive concept, an embodiment of the present invention further provides an image reasoning device for executing the corresponding steps in the above method embodiment and each possible implementation manner. An implementation method of the image reasoning device is given below.

[0085] Please refer to Figure 6 , Figure 6 FIG. 6 is a block diagram of an image reasoning device 600 provided in an embodiment of the present invention. Figure 2 The computer device in the image reasoning device 600 includes:

[0086] An acquisition module 610 is used to acquire image frames of a video stream;

[0087] The detection module 620 is further used to detect and track objects in the image frame and obtain metadata of the object; the metadata includes at least an object ID;

[0088] The judgment module 630 is used to judge whether the image frame meets a preset reasoning condition, where the preset reasoning condition is any one of the following: the cached object ID does not exist; the cached object ID is invalid; the cached object ID is valid and there is a missing attribute in the metadata corresponding to the object ID;

[0089] The reasoning module 640 is used to perform attribute reasoning on the image frame when the judgment module 630 determines that the preset reasoning condition is met.

[0090] It is understandable that the acquisition module 610, the detection module 620, the judgment module 630 and the reasoning module 640 can be executed in a coordinated manner. Figure 4 Each step in the process is performed to achieve the corresponding technical effect.

[0091] Optionally, the inference module 640 is specifically used to: if there is no cached object ID, or the cached object ID is invalid, then obtain the inference model corresponding to each attribute, and use each inference model to perform attribute inference on the image frame respectively; if there are missing attributes in the metadata corresponding to the cached and valid object ID, then obtain the inference model corresponding to the missing attribute, and use the inference model corresponding to the missing attribute to perform attribute inference on the image frame.

[0092] Optionally, the judgment module 630 is specifically used to: if there is a cached object ID, then determine whether the cache duration of the object ID is greater than a preset duration; if greater, determine that the cached object ID is invalid and the image frame meets the preset reasoning condition; if less than or equal to, determine whether there is a missing attribute in the cached metadata of the object ID; if so, determine that the image frame meets the preset reasoning condition; if not, determine that the image frame does not meet the preset reasoning condition; if there is no cached object ID, determine that the image frame meets the preset reasoning condition.

[0093] Optionally, the image reasoning device 600 may further include a deletion module, which is used to delete the cache corresponding to the object ID if the time difference between the cache duration and the duration of the object ID exceeds a preset time difference.

[0094] Optionally, the image reasoning device 600 may further include a cache module for setting a duration for the object ID if there is no cached object ID, and caching the object ID and newly inferred attribute information.

[0095] Optionally, the image reasoning device 600 may also include an update module for updating cached historical attribute information corresponding to the dynamic attribute according to a preset update frequency using new attribute information of the dynamic attribute corresponding to the object ID in the metadata; and configuring an update mark for the updated dynamic attribute.

[0096] Optionally, the acquisition module 610 is specifically used to acquire a video stream to be analyzed, perform frame extraction processing on the video stream, and obtain image frames.

[0097] It should be noted that the division of modules in the above embodiments of the present invention is schematic and is only a logical function division. There may be other division methods in actual implementation. In addition, each functional unit in each embodiment of the present invention may be integrated into a processing unit, or may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0098] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a readable storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of the various embodiments of the present invention. The aforementioned readable storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., and other media that can store program codes.

[0099] The embodiment of the present invention also provides a computer device for executing the image reasoning method in the embodiment of the present invention, please refer to Figure 7 , Figure 7 The block diagram of a computer device 700 provided by an embodiment of the present invention is shown. The computer device 700 may be a server, a personal computer, an edge gateway, etc., and includes a processor 701, a memory 702, a bus 703, and a communication interface 704. The processor 701 is connected to the memory 702 via the bus 703.

[0100] The memory 702 is used to store programs, such as Figure 6The image reasoning device 600 shown includes at least one software function module that can be stored in the memory 702 in the form of software or firmware. After receiving the execution instruction, the processor 701 executes the program to implement the image screening method disclosed in the above embodiment.

[0101] The memory 702 may include a high-speed random access memory (RAM) and may also include a non-volatile memory (NVM).

[0102] The processor 701 may be an integrated circuit chip with signal processing capability. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor 701 or an instruction in the form of software. The above processor 701 may be a general-purpose processor, including a central processing unit (CPU), a microcontroller unit (MCU), a complex programmable logic device (CPLD), a field programmable gate array (FPGA), an embedded ARM and other chips.

[0103] In this embodiment, the processor 701 may include a CPU and an AI chip. The AI ​​chip executes Figure 6 The acquisition module 610 and the detection module 620 in the image reasoning device 600 shown in the figure are used to implement image processing, and the CPU executes Figure 6 The judgment module 630 and the reasoning module 640 in the image reasoning device 600 are shown to implement image reasoning.

[0104] Based on the above embodiments, the present invention further provides a readable storage medium, in which a computer program is stored. When the computer program is executed by a computer, the computer executes the image reasoning method provided in the above embodiments.

[0105] Based on the above embodiments, an embodiment of the present invention further provides a computer program. When the computer program is run on a computer, the computer executes the image reasoning method provided by the above embodiments.

[0106] Based on the above embodiments, an embodiment of the present invention further provides a chip, which is used to read a computer program stored in a memory and to execute the image reasoning method provided in the above embodiments.

[0107] A computer program product is also provided in an embodiment of the present invention, including instructions, which, when executed on a computer, enable the computer to execute the image reasoning method provided in the above embodiment.

[0108] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by instructions. These instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0109] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0110] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0111] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims

1. An image reasoning method, characterized in that: The method comprises: Get the image frame of the video stream; Performing object detection and tracking on the image frame to obtain metadata of the object; the metadata at least includes an object ID; According to the object ID, determine whether the image frame meets a preset reasoning condition; wherein the preset reasoning condition is any one of the following: the cached object ID does not exist; the cached object ID is invalid; the cached object ID is valid and there is a missing attribute in the metadata corresponding to the object ID; If so, attribute inference is performed on the image frame; otherwise, attribute inference is not performed on the image frame.

2. The image reasoning method according to claim 1, characterized in that: The performing attribute reasoning on the image frame comprises: If the cached object ID does not exist, or the cached object ID is invalid, then obtaining the inference model corresponding to each attribute, and using each inference model to perform attribute inference on the image frame respectively; If there are missing attributes in the metadata corresponding to the cached and valid object ID, the inference model corresponding to the missing attribute is obtained, and the attribute inference of the image frame is performed using the inference model corresponding to the missing attribute.

3. The image reasoning method according to claim 1, characterized in that: The determining, based on the object ID, whether the image frame satisfies a preset reasoning condition includes: If the object ID has been cached, determine whether the cache duration of the object ID is greater than the preset duration; if greater, determine that the cached object ID is invalid and the image frame meets the preset reasoning condition; if less than or equal to, determine whether the missing attribute exists in the metadata of the cached object ID; if so, determine that the image frame meets the preset reasoning condition; if not, determine that the image frame does not meet the preset reasoning condition; If the cached object ID does not exist, it is determined that the image frame meets the preset reasoning condition.

4. The image reasoning method according to claim 3, characterized in that: The method further comprises: If the time difference between the cache duration of the object ID and the duration exceeds a preset time difference, the cache corresponding to the object ID is deleted.

5. The image reasoning method according to claim 2, characterized in that: The method further comprises: If the object ID does not exist in the cache, a duration is configured for the object ID and the newly inferred attribute information, and the object ID and the newly inferred attribute information are cached.

6. The image reasoning method according to claim 1, characterized in that: The method further comprises: According to a preset update frequency, the cached historical attribute information corresponding to the dynamic attribute is updated using the new attribute information of the dynamic attribute corresponding to the object ID in the metadata; An update flag is configured for the updated dynamic attribute.

7. The image reasoning method according to claim 1, characterized in that: The step of obtaining the image frame of the video stream comprises: A video stream to be analyzed is obtained, and frame extraction is performed on the video stream to obtain the image frame.

8. An image reasoning device, characterized in that: include: An acquisition module, used for acquiring image frames of a video stream; A detection module, used to detect and track the object on the image frame and obtain metadata of the object; the metadata at least includes an object ID; A judgment module is used to judge whether the image frame meets a preset reasoning condition, wherein the preset reasoning condition is any one of the following: the cached object ID does not exist; the cached object ID is invalid; the cached object ID is valid and there is a missing attribute in the metadata corresponding to the object ID; The inference module is used to perform attribute inference on the image frame when the judgment module determines that the preset inference condition is met.

9. A computer device, characterized in that: The invention comprises a processor and a memory, wherein the memory stores a computer program executable by the processor, and the processor can execute the computer program to implement the image reasoning method according to any one of claims 1 to 7.

10. A readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the image reasoning method according to any one of claims 1 to 7 is implemented.