CN114359673B - Small sample smoke detection method, device and equipment based on metric learning - Google Patents
Small sample smoke detection method, device and equipment based on metric learning Download PDFInfo
- Publication number
- CN114359673B CN114359673B CN202210019924.0A CN202210019924A CN114359673B CN 114359673 B CN114359673 B CN 114359673B CN 202210019924 A CN202210019924 A CN 202210019924A CN 114359673 B CN114359673 B CN 114359673B
- Authority
- CN
- China
- Prior art keywords
- image block
- distance
- current frame
- smoke
- sub
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 239000000779 smoke Substances 0.000 title claims abstract description 97
- 238000001514 detection method Methods 0.000 title claims abstract description 29
- 230000004044 response Effects 0.000 claims abstract description 33
- 238000000034 method Methods 0.000 claims abstract description 31
- 238000004590 computer program Methods 0.000 claims description 10
- 238000012549 training Methods 0.000 abstract description 5
- 238000004891 communication Methods 0.000 description 8
- 238000010586 diagram Methods 0.000 description 8
- 230000006870 function Effects 0.000 description 7
- 238000012545 processing Methods 0.000 description 4
- 238000013135 deep learning Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 230000008901 benefit Effects 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 239000000835 fiber Substances 0.000 description 1
- 230000002452 interceptive effect Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Landscapes
- Image Analysis (AREA)
Abstract
Embodiments of the present disclosure disclose a method, apparatus, electronic device, and computer-readable medium for small sample smoke detection based on metric learning. One embodiment of the method comprises the following steps: acquiring a first frame and a current frame of a target video; dividing the first frame and the current frame into corresponding sub-image blocks, and executing the following steps on each pair of sub-image blocks: inputting the first frame sub-image block and the corresponding current frame sub-image block into a first metric network to obtain a first distance; responding to the fact that the first distance is larger than a first threshold value, inputting a superposition result of the first frame sub-image block and the smoke template image and the current frame sub-image block into a second metric network to obtain a second distance; and determining the current frame sub-image block as a smoke image block in response to the second distance meeting a preset condition. The method reduces the need for smoke training data by using metric learning.
Description
Technical Field
Embodiments of the present disclosure relate to the field of computer technology, and in particular, to a method, apparatus, device, and computer readable medium for detecting small sample smoke based on metric learning.
Background
In the existing deep learning-based smoke detection technology, a large amount of training data is often required to ensure the reliability of detection results, and a large amount of manpower is required to acquire and label the training data due to the limited smoke scenes and the irregularity of the smoke shapes, so that the deep learning-based smoke detection is challenged.
Disclosure of Invention
The disclosure is in part intended to introduce concepts in a simplified form that are further described below in the detailed description. The disclosure is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
Some embodiments of the present disclosure propose a small sample smoke detection method, apparatus, device and computer readable medium based on metric learning to solve the technical problems mentioned in the background section above.
In a first aspect, some embodiments of the present disclosure provide a method of small sample smoke detection based on metric learning, the method comprising: acquiring a first frame and a current frame of a target video; dividing the first frame and the current frame into corresponding sub-image blocks, and executing the following steps on each pair of sub-image blocks: inputting the first frame sub-image block and the corresponding current frame sub-image block into a first metric network to obtain a first distance; responding to the fact that the first distance is larger than a first threshold value, inputting a superposition result of the first frame sub-image block and the smoke template image and the current frame sub-image block into a second metric network to obtain a second distance; and determining the current frame sub-image block as a smoke image block in response to the second distance meeting a preset condition.
In a second aspect, some embodiments of the present disclosure provide a small sample smoke detection device based on metric learning, the device comprising: an acquisition unit configured to acquire a first frame and a current frame of a target video; a dividing unit configured to divide the first frame and the current frame into corresponding sub-image blocks, the following steps being performed on each pair of sub-image blocks: the first input unit is configured to input the first frame sub-image block and the corresponding current frame sub-image block into a first metric network to obtain a first distance; the second input unit is configured to respond to the fact that the first distance is larger than a first threshold value, and input a superposition result of the first frame sub-image block and the smoke template image and the current frame sub-image block into a second metric network to obtain a second distance; and a determining unit configured to determine the current frame sub-image block as a smoke image block in response to the second distance satisfying a preset condition.
In a third aspect, some embodiments of the present disclosure provide an electronic device comprising: one or more processors; a storage device having one or more programs stored thereon, which when executed by one or more processors, cause the one or more processors to implement the method as described in any of the implementations of the first aspect.
In a fourth aspect, some embodiments of the present disclosure provide a computer readable medium having a computer program stored thereon, wherein the program when executed by a processor implements a method as described in any of the implementations of the first aspect.
One of the above embodiments of the present disclosure has the following advantageous effects: by using metric learning, the need for smoke training data is reduced, so that deep learning based smoke detection techniques can be deployed for application in data starved scenarios.
Drawings
The above and other features, advantages, and aspects of embodiments of the present disclosure will become more apparent by reference to the following detailed description when taken in conjunction with the accompanying drawings. The same or similar reference numbers will be used throughout the drawings to refer to the same or like elements. It should be understood that the figures are schematic and that elements and components are not necessarily drawn to scale.
Fig. 1 is a schematic diagram of one application scenario of a metric learning-based small sample smoke detection method of some embodiments of the present disclosure;
FIG. 2 is a flow chart of some embodiments of a metric learning-based small sample smoke detection method according to the present disclosure;
FIG. 3 is a flow chart of other embodiments of a metric learning based small sample smoke detection method according to the present disclosure;
fig. 4 is a schematic structural view of some embodiments of a smoke detection device according to the present disclosure;
fig. 5 is a schematic structural diagram of an electronic device suitable for use in implementing some embodiments of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete. It should be understood that the drawings and embodiments of the present disclosure are for illustration purposes only and are not intended to limit the scope of the present disclosure.
It should be noted that, for convenience of description, only the portions related to the present invention are shown in the drawings. Embodiments of the present disclosure and features of embodiments may be combined with each other without conflict.
It should be noted that the terms "first," "second," and the like in this disclosure are merely used to distinguish between different devices, modules, or units and are not used to define an order or interdependence of functions performed by the devices, modules, or units.
It should be noted that references to "one", "a plurality" and "a plurality" in this disclosure are intended to be illustrative rather than limiting, and those of ordinary skill in the art will appreciate that "one or more" is intended to be understood as "one or more" unless the context clearly indicates otherwise.
The names of messages or information interacted between the various devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
Fig. 1 shows a schematic diagram of one application scenario of a metric learning-based small sample smoke detection method to which some embodiments of the present disclosure may be applied.
In the application scenario shown in fig. 1, the computing device 101 first acquires the first frame 103 and the current frame 104 of the target video 102, then divides the first frame 103 and the current frame 104 into corresponding sub-image blocks, and in this embodiment, the computing device 101 divides the first frame 103 and the current frame 104 into four sub-image blocks, and performs the following steps for each pair of sub-image blocks: the first frame sub-image block 108 and the corresponding current frame sub-image block 111 are input to the first metric network 105, resulting in a first distance 106, in this embodiment the first distance 106 is 2.45. In response to the first distance 106 being greater than the first threshold 107, in this embodiment, the first threshold 107 is 1, the first distance 106 satisfies a condition greater than the first threshold, and the superposition result 110 of the first frame sub-image block 108 and the smoke template image 109 and the current frame sub-image block 111 are input to the second metric network 112, resulting in a second distance 113, in this embodiment, the second distance 113 is 0.16. In response to the second distance 113 meeting the preset condition 114, the current frame sub-image block 111 is determined to be a smoke image block, in this embodiment the second distance 113 meeting the preset condition "<0.5", whereupon the computing device 101 determines the current frame sub-image block to be a smoke image block.
The computing device 101 may be hardware or software. When the computing device is hardware, it may be implemented as a distributed cluster of multiple servers or electronic devices, or as a single server or single electronic device. When the computing device is embodied as software, it may be implemented as a plurality of software or software modules, for example, to provide distributed services, or as a single software or software module. The present invention is not particularly limited herein.
It should be understood that the number of computing devices 101 in fig. 1 is merely illustrative. There may be any number of computing devices 101 as desired for an implementation.
With continued reference to fig. 2, a flow 200 of some embodiments of a metric learning-based small sample smoke detection method according to the present disclosure is shown. The small sample smoke detection method based on metric learning comprises the following steps:
step 201, a first frame and a current frame of a target video are acquired.
In some embodiments, an execution subject of the metric learning-based small sample smoke detection method (e.g., the computing device shown in fig. 1) may obtain the first frame and the current frame of the target video in an offline manner.
In some embodiments, the executing body may further acquire the first frame and the current frame of the target video through wireless communication.
Step 202, dividing the first frame and the current frame into corresponding sub-image blocks, and executing the following steps on each pair of sub-image blocks.
In some embodiments, the executing entity may divide the first frame and the current frame into corresponding sub-image blocks that do not overlap, for example, dividing the first frame into sub-image blocks with a size of 100×100 every 100 columns and 100 rows.
In some embodiments, the executing body may further divide the first frame and the current frame into corresponding sub-image blocks having overlapping areas, for example, dividing the first frame and the current frame into sub-image blocks with a size of 100×100 every 50 columns and 50 rows.
Step 203, inputting the first frame sub-image block and the corresponding current frame sub-image block into a first metric network to obtain a first distance.
In some embodiments, the first metric network may be a network trained using a smoke dataset.
In some alternative implementations of some embodiments, the first metric network may be a metric network trained using a non-smoke dataset.
In some alternative implementations of some embodiments, the first metric network may be a metric network trained using a non-smoke dataset and trimmed using a smoke dataset.
And 204, in response to the first distance being greater than the first threshold, inputting the superposition result of the first frame sub-image block and the smoke template image and the current frame sub-image block into a second metric network to obtain a second distance.
In some embodiments, the second metric network may be a network trained using a smoke dataset.
In some alternative implementations of some embodiments, the second metric network may be a metric network trained using non-smoke data sets.
In some alternative implementations of some embodiments, the second metric network may be a metric network trained using a non-smoke dataset and trimmed using a smoke dataset.
In step 205, in response to the second distance meeting the preset condition, the current frame sub-image block is determined to be a smoke image block.
In some embodiments, the executing body may determine the current frame sub-image block as the smoke image block in response to the second distance being smaller than the first distance.
In some optional implementations of some embodiments, the executing entity may determine the current frame sub-image block as the smoke image block in response to the second distance being less than a second threshold.
In some optional implementations of some embodiments, the executing entity may first obtain a target image set, then input each image in the target image set and a current frame sub-image block into the second metric network in sequence, obtain a third distance set, and finally determine the current frame sub-image block as a smoke image block in response to the second distance being less than each third distance in the third distance set.
The method provided by some embodiments of the present disclosure can better cope with noise in the form of cloud, fog, and the like in a detection scene.
With further reference to fig. 3, a flow 300 of further embodiments of a small sample smoke detection method based on metric learning is shown. The flow 300 of the forest fire smoke detection method based on the gray value increasing number sequence comprises the following steps:
step 301, a first frame and a current frame of a target video are acquired.
Step 302, dividing the first frame and the current frame into corresponding sub-image blocks, and performing the following steps on each pair of sub-image blocks.
Step 303, inputting the first frame sub-image block and the corresponding current frame sub-image block into a first metric network to obtain a first distance.
And step 304, in response to the first distance being greater than the first threshold, inputting the superposition result of the first frame sub-image block and the smoke template image and the current frame sub-image block into a second metric network to obtain a second distance.
In some embodiments, the specific implementation of steps 301 to 304 and the technical effects thereof may refer to steps 201 to 204 in the corresponding embodiment of fig. 2, which are not described herein.
Step 305, a set of target images is acquired.
In some embodiments, an execution subject of the metric learning-based small sample smoke detection method (e.g., the computing device shown in fig. 1) may obtain the first frame and the current frame of the target video in an offline manner.
In some embodiments, the executing body may further acquire the first frame and the current frame of the target video through wireless communication.
And step 306, inputting each image in the target image set and the current frame sub-image block into a second metric network in sequence to obtain a third distance set.
In response to the second distance being less than each third distance in the third set of distances, the current frame sub-image block is determined to be a smoke image block, step 307.
As can be seen from fig. 3, compared to the description of some embodiments corresponding to fig. 2, the flow 300 of the small sample smoke detection method based on metric learning in some embodiments corresponding to fig. 3 embodies a step of measuring each image in the target image set with the current frame sub-image block, by which the method can effectively exclude interfering objects, such as automobiles, pedestrians, etc., contained in the target image set, thereby being more robust to noise in a scene.
With further reference to fig. 4, as an implementation of the method shown in the above figures, the present disclosure provides embodiments of a smoke detection apparatus, corresponding to those shown in fig. 2, which may find particular application in a variety of electronic devices.
As shown in fig. 4, the smoke detection apparatus 400 of some embodiments includes: an acquisition unit 401, a division unit 402, a first input unit 403, a second input unit 404, and a determination unit 405. There is provided, in accordance with one or more embodiments of the present disclosure, a smoke detection device comprising: an acquisition unit 401 configured to acquire a first frame and a current frame of a target video; a dividing unit 402 configured to divide the first frame and the current frame into corresponding sub-image blocks, and perform the following steps for each pair of sub-image blocks: a first input unit 403 configured to input the first frame sub-image block and the corresponding current frame sub-image block to a first metric network, resulting in a first distance; a second input unit 404 configured to input a superposition result of the first frame sub-image block and the smoke template image and the current frame sub-image block to a second metric network to obtain a second distance in response to the first distance being greater than a first threshold; a determining unit 405 configured to determine the current frame sub-image block as a smoke image block in response to the second distance satisfying a preset condition.
In an alternative implementation of some embodiments, the determining unit 405 is further configured to: in response to the second distance being less than the second threshold, the current frame sub-image block is determined to be a smoke image block.
In an alternative implementation of some embodiments, the apparatus 400 further comprises: an acquisition unit configured to: acquiring a target image set; a third input unit configured to: and inputting each image in the target image set and the current frame sub-image block into a second metric network in sequence to obtain a third distance set.
In an alternative implementation of some embodiments, the determining unit 405 is further configured to: in response to the second distance being less than each third distance in the third set of distances, the current frame sub-image block is determined to be a smoke image block.
In an alternative implementation of some embodiments, the first metric network, the second metric network comprise a metric network trained using a non-smoke dataset.
In an alternative implementation of some embodiments, the first metric network, the second metric network, comprises a metric network trained using a non-smoke dataset, trimmed using a smoke dataset.
It will be appreciated that the elements described in the apparatus 400 correspond to the various steps in the method described with reference to fig. 2. Thus, the operations, features and resulting benefits described above with respect to the method are equally applicable to the apparatus 400 and the units contained therein, and are not described in detail herein.
Referring now to fig. 5, a schematic diagram of an electronic device (e.g., server or terminal device of fig. 1) 500 suitable for use in implementing some embodiments of the present disclosure is shown. The electronic devices in some embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), car terminals (e.g., car navigation terminals), and the like, as well as stationary terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 5 is merely an example and should not impose any limitations on the functionality and scope of use of embodiments of the present disclosure.
As shown in fig. 5, the electronic device 500 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 501, which may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 502 or a program loaded from a storage means 508 into a Random Access Memory (RAM) 503. In the RAM503, various programs and data required for the operation of the electronic apparatus 500 are also stored. The processing device 501, the ROM 502, and the RAM503 are connected to each other via a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
In general, the following devices may be connected to the I/O interface 505: input devices 506 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 507 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 508 including, for example, magnetic tape, hard disk, etc.; and communication means 509. The communication means 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. While fig. 5 shows an electronic device 500 having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead. Each block shown in fig. 5 may represent one device or a plurality of devices as needed.
In particular, according to some embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, some embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such embodiments, the computer program may be downloaded and installed from a network via the communications device 509, or from the storage device 508, or from the ROM 502. The above-described functions defined in the methods of some embodiments of the present disclosure are performed when the computer program is executed by the processing device 501.
It should be noted that the computer readable medium according to some embodiments of the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In some embodiments of the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In some embodiments of the present disclosure, however, the computer-readable signal medium may comprise a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
In some implementations, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol ), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the internet (e.g., the internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device. The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: acquiring a first frame and a current frame of a target video; dividing the first frame and the current frame into corresponding sub-image blocks, and executing the following steps on each pair of sub-image blocks: inputting the first frame sub-image block and the corresponding current frame sub-image block into a first metric network to obtain a first distance; responding to the fact that the first distance is larger than a first threshold value, inputting a superposition result of the first frame sub-image block and the smoke template image and the current frame sub-image block into a second metric network to obtain a second distance; and determining the current frame sub-image block as a smoke image block in response to the second distance meeting a preset condition. The method reduces the need for smoke training data by using metric learning.
Computer program code for carrying out operations for some embodiments of the present disclosure may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in some embodiments of the present disclosure may be implemented by means of software, or may be implemented by means of hardware. The described units may also be provided in a processor, for example, described as: a processor includes an acquisition unit, a division unit, a first input unit, a second input unit, and a determination unit. The names of these units do not constitute a limitation on the unit itself in some cases, and the determination unit may also be described as "a unit that determines a smoke image block", for example.
The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a Complex Programmable Logic Device (CPLD), and the like.
In accordance with one or more embodiments of the present disclosure, there is provided a small sample smoke detection method based on metric learning, comprising: acquiring a first frame and a current frame of a target video; dividing the first frame and the current frame into corresponding sub-image blocks, and executing the following steps on each pair of sub-image blocks: inputting the first frame sub-image block and the corresponding current frame sub-image block into a first metric network to obtain a first distance; responding to the fact that the first distance is larger than a first threshold value, inputting a superposition result of the first frame sub-image block and the smoke template image and the current frame sub-image block into a second metric network to obtain a second distance; and determining the current frame sub-image block as a smoke image block in response to the second distance meeting a preset condition.
According to one or more embodiments of the present disclosure, determining the current frame sub-image block as a smoke image block in response to the second distance satisfying a preset condition includes: in response to the second distance being less than the second threshold, the current frame sub-image block is determined to be a smoke image block.
According to one or more embodiments of the present disclosure, after the superimposing result of the first frame sub-image block and the smoke template image and the current frame sub-image block are input to the second metric network in response to the first distance being greater than the first threshold, the method further comprises: acquiring a target image set; and inputting each image in the target image set and the current frame sub-image block into a second metric network in sequence to obtain a third distance set.
According to one or more embodiments of the present disclosure, determining the current frame sub-image block as a smoke image block in response to the second distance satisfying a preset condition includes: in response to the second distance being less than each third distance in the third set of distances, the current frame sub-image block is determined to be a smoke image block.
In accordance with one or more embodiments of the present disclosure, the first metric network, the second metric network, comprise a metric network trained using a non-smoke dataset.
In accordance with one or more embodiments of the present disclosure, the first and second metrology networks include metrology networks trained using non-smoke data sets, trimmed using smoke data sets.
According to one or more embodiments of the present disclosure, there is provided a smoke detection apparatus comprising: an acquisition unit configured to acquire a first frame and a current frame of a target video; a dividing unit configured to divide the first frame and the current frame into corresponding sub-image blocks, the following steps being performed on each pair of sub-image blocks: the first input unit is configured to input the first frame sub-image block and the corresponding current frame sub-image block into a first metric network to obtain a first distance; the second input unit is configured to respond to the fact that the first distance is larger than a first threshold value, and input a superposition result of the first frame sub-image block and the smoke template image and the current frame sub-image block into a second metric network to obtain a second distance; and a determining unit configured to determine the current frame sub-image block as a smoke image block in response to the second distance satisfying a preset condition.
According to one or more embodiments of the present disclosure, the determining unit is further configured to: in response to the second distance being less than the second threshold, the current frame sub-image block is determined to be a smoke image block.
According to one or more embodiments of the present disclosure, the apparatus further comprises: an acquisition unit configured to: acquiring a target image set; a third input unit configured to: and inputting each image in the target image set and the current frame sub-image block into a second metric network in sequence to obtain a third distance set.
According to one or more embodiments of the present disclosure, the determining unit is further configured to: in response to the second distance being less than each third distance in the third set of distances, the current frame sub-image block is determined to be a smoke image block.
In accordance with one or more embodiments of the present disclosure, the first metric network, the second metric network, comprise a metric network trained using a non-smoke dataset.
In accordance with one or more embodiments of the present disclosure, the first and second metrology networks include metrology networks trained using non-smoke data sets, trimmed using smoke data sets.
According to one or more embodiments of the present disclosure, there is provided an electronic device including: one or more processors; and a storage device having one or more programs stored thereon, which when executed by the one or more processors, cause the one or more processors to implement a method as described above.
According to one or more embodiments of the present disclosure, a computer readable medium is provided, on which a computer program is stored, wherein the program, when executed by a processor, implements a method as described in any of the above.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by those skilled in the art that the scope of the invention in the embodiments of the present disclosure is not limited to the specific combination of the above technical features, but encompasses other technical features formed by any combination of the above technical features or their equivalents without departing from the spirit of the invention. Such as the above-described features, are mutually substituted with (but not limited to) the features having similar functions disclosed in the embodiments of the present disclosure.
Claims (9)
1. A method for detecting smoke in a small sample based on metric learning, comprising:
acquiring a first frame and a current frame of a target video;
dividing the first frame and the current frame into corresponding sub-image blocks, and executing the following steps on each pair of sub-image blocks:
inputting the first frame sub-image block and the corresponding current frame sub-image block into a first metric network to obtain a first distance;
responding to the first distance being larger than a first threshold value, inputting a superposition result of the first frame sub-image block and the smoke template image and the current frame sub-image block into a second metric network to obtain a second distance;
and determining the current frame sub-image block as a smoke image block in response to the second distance meeting a preset condition.
2. The method of claim 1, wherein the determining the current frame sub-image block as a smoke image block in response to the second distance satisfying a preset condition comprises:
and determining the current frame sub-image block as a smoke image block in response to the second distance being less than a second threshold.
3. The method of claim 1, wherein after said superimposing the first frame sub-image block with the smoke template image and the current frame sub-image block are input to a second metric network in response to the first distance being greater than a first threshold, the method further comprises:
acquiring a target image set;
and inputting each image in the target image set and the current frame sub-image block into the second metric network in sequence to obtain a third distance set.
4. A method according to claim 3, wherein said determining the current frame sub-image block as a smoke image block in response to the second distance meeting a preset condition comprises:
in response to the second distance being less than each third distance in the third set of distances, the current frame sub-image block is determined to be a smoke image block.
5. The method of claim 1, wherein the first metric network, the second metric network comprise a metric network trained using a non-smoke dataset.
6. The method of claim 1, wherein the first and second metric networks comprise metric networks trained using non-smoke data sets and trimmed using smoke data sets.
7. A small sample smoke detection apparatus based on metric learning, comprising:
an acquisition unit configured to acquire a first frame and a current frame of a target video;
a dividing unit configured to divide the first frame and the current frame into corresponding sub-image blocks, the steps being performed on each pair of sub-image blocks:
the first input unit is configured to input the first frame sub-image block and the corresponding second frame sub-image block into a first metric network to obtain a first distance;
the second input unit is configured to respond to the fact that the first distance is larger than a first threshold value, and input a superposition result of the first frame sub-image block and the smoke template image and the current frame sub-image block into a second metric network to obtain a second distance;
and a determining unit configured to determine the current frame sub-image block as a smoke image block in response to the second distance satisfying a preset condition.
8. An electronic device, comprising:
one or more processors;
a storage device having one or more programs stored thereon,
when executed by the one or more processors, causes the one or more processors to implement the method recited in any one of claims 1-6.
9. A computer readable medium having stored thereon a computer program, wherein the program when executed by a processor implements the method as claimed in any of claims 1-6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210019924.0A CN114359673B (en) | 2022-01-10 | 2022-01-10 | Small sample smoke detection method, device and equipment based on metric learning |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210019924.0A CN114359673B (en) | 2022-01-10 | 2022-01-10 | Small sample smoke detection method, device and equipment based on metric learning |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114359673A CN114359673A (en) | 2022-04-15 |
CN114359673B true CN114359673B (en) | 2024-04-09 |
Family
ID=81106759
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210019924.0A Active CN114359673B (en) | 2022-01-10 | 2022-01-10 | Small sample smoke detection method, device and equipment based on metric learning |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114359673B (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109271929A (en) * | 2018-09-14 | 2019-01-25 | 北京字节跳动网络技术有限公司 | Detection method and device |
CN110363104A (en) * | 2019-06-24 | 2019-10-22 | 中国科学技术大学 | A kind of detection method of diesel oil black smoke vehicle |
CN111126293A (en) * | 2019-12-25 | 2020-05-08 | 国网智能科技股份有限公司 | Flame and smoke abnormal condition detection method and system |
CN111400533A (en) * | 2020-03-02 | 2020-07-10 | 北京三快在线科技有限公司 | Image screening method and device, electronic equipment and storage medium |
CN113033555A (en) * | 2021-03-25 | 2021-06-25 | 天津大学 | Visual SLAM closed loop detection method based on metric learning |
-
2022
- 2022-01-10 CN CN202210019924.0A patent/CN114359673B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109271929A (en) * | 2018-09-14 | 2019-01-25 | 北京字节跳动网络技术有限公司 | Detection method and device |
WO2020052062A1 (en) * | 2018-09-14 | 2020-03-19 | 北京字节跳动网络技术有限公司 | Detection method and device |
CN110363104A (en) * | 2019-06-24 | 2019-10-22 | 中国科学技术大学 | A kind of detection method of diesel oil black smoke vehicle |
CN111126293A (en) * | 2019-12-25 | 2020-05-08 | 国网智能科技股份有限公司 | Flame and smoke abnormal condition detection method and system |
CN111400533A (en) * | 2020-03-02 | 2020-07-10 | 北京三快在线科技有限公司 | Image screening method and device, electronic equipment and storage medium |
CN113033555A (en) * | 2021-03-25 | 2021-06-25 | 天津大学 | Visual SLAM closed loop detection method based on metric learning |
Non-Patent Citations (1)
Title |
---|
基于小波的实时烟雾检测;帅师;周平;汪亚明;周维达;;计算机应用研究;20070310(第03期);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN114359673A (en) | 2022-04-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111784712B (en) | Image processing method, device, equipment and computer readable medium | |
CN111222509B (en) | Target detection method and device and electronic equipment | |
CN112418232B (en) | Image segmentation method and device, readable medium and electronic equipment | |
CN111461968B (en) | Picture processing method, device, electronic equipment and computer readable medium | |
CN111461967B (en) | Picture processing method, device, equipment and computer readable medium | |
CN112330788A (en) | Image processing method, image processing device, readable medium and electronic equipment | |
CN111459364A (en) | Icon updating method and device and electronic equipment | |
CN110866524A (en) | License plate detection method, device, equipment and storage medium | |
CN111258582B (en) | Window rendering method and device, computer equipment and storage medium | |
CN110852242A (en) | Watermark identification method, device, equipment and storage medium based on multi-scale network | |
CN114359673B (en) | Small sample smoke detection method, device and equipment based on metric learning | |
CN112418233B (en) | Image processing method and device, readable medium and electronic equipment | |
CN111680754B (en) | Image classification method, device, electronic equipment and computer readable storage medium | |
CN113240108B (en) | Model training method and device and electronic equipment | |
CN113222050B (en) | Image classification method and device, readable medium and electronic equipment | |
CN115086541B (en) | Shooting position determining method, device, equipment and medium | |
CN110796144B (en) | License plate detection method, device, equipment and storage medium | |
CN111461964B (en) | Picture processing method, device, electronic equipment and computer readable medium | |
CN114419298A (en) | Virtual object generation method, device, equipment and storage medium | |
CN110991312A (en) | Method, apparatus, electronic device, and medium for generating detection information | |
CN113744259B (en) | Forest fire smoke detection method and equipment based on gray value increasing number sequence | |
CN113256659B (en) | Picture processing method and device and electronic equipment | |
CN111489286B (en) | Picture processing method, device, equipment and medium | |
CN112488943B (en) | Model training and image defogging method, device and equipment | |
CN111815656B (en) | Video processing method, apparatus, electronic device and computer readable medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |