CN114821264B - Algorithm efficiency improving method based on neural network - Google Patents

Algorithm efficiency improving method based on neural network Download PDF

Info

Publication number
CN114821264B
CN114821264B CN202210312297.XA CN202210312297A CN114821264B CN 114821264 B CN114821264 B CN 114821264B CN 202210312297 A CN202210312297 A CN 202210312297A CN 114821264 B CN114821264 B CN 114821264B
Authority
CN
China
Prior art keywords
garbage
indoor
pin
cpu
image
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
Application number
CN202210312297.XA
Other languages
Chinese (zh)
Other versions
CN114821264A (en
Inventor
余丹
兰雨晴
张腾怀
葛宇童
于艺春
黄永琢
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Standard Intelligent Security Technology Co Ltd
Original Assignee
China Standard Intelligent Security Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by China Standard Intelligent Security Technology Co Ltd filed Critical China Standard Intelligent Security Technology Co Ltd
Priority to CN202210312297.XA priority Critical patent/CN114821264B/en
Publication of CN114821264A publication Critical patent/CN114821264A/en
Application granted granted Critical
Publication of CN114821264B publication Critical patent/CN114821264B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/26Power supply means, e.g. regulation thereof
    • G06F1/32Means for saving power
    • G06F1/3203Power management, i.e. event-based initiation of a power-saving mode
    • G06F1/3234Power saving characterised by the action undertaken
    • G06F1/3287Power saving characterised by the action undertaken by switching off individual functional units in the computer system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Computing Systems (AREA)
  • Evolutionary Computation (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Biophysics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Computer Hardware Design (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Evolutionary Biology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Image Analysis (AREA)

Abstract

The embodiment of the invention discloses an algorithm efficiency improving method based on a neural network, and relates to the technical field of neural networks. The method comprises the following steps: acquiring a preset number of indoor garbage images to obtain a training sample set; training a preset indoor garbage detection neural network by using the training sample set; collecting a plurality of indoor images of the specified garbage to obtain an image set corresponding to the specified garbage, and adding a garbage type label to the indoor images of the specified garbage; and performing deep learning on the image set corresponding to each type of rubbish based on the trained indoor rubbish detection neural network to obtain the feature data of each type of rubbish. The indoor garbage image training system can train indoor partial garbage images and then train in batches, effectively reduces the number of training layers and improves the training efficiency.

Description

Algorithm efficiency improving method based on neural network
Technical Field
The invention belongs to the technical field of neural networks, and particularly relates to an algorithm efficiency improving method based on a neural network.
Background
Deep Learning (DL) is a new research direction in the field of Machine Learning (ML), which is introduced into Machine Learning to make it closer to the original target, artificial Intelligence (AI). Deep learning is the intrinsic law and expression level of the learning sample data, and the information obtained in the learning process is very helpful for the interpretation of data such as characters, images and sounds. The final aim of the method is to enable a machine to have analysis and learning capabilities like a human, and to recognize data such as characters, images and sounds. At present, deep learning is a complex machine learning algorithm, and the effect of the deep learning in the aspects of voice and image recognition is far better than that of the prior related technology. As the basis of deep learning, namely a neural network algorithm, when the method is applied to an indoor garbage detection and recognition scene, because the types of indoor garbage are more and more different, and the types are also different, image data sets required to be used for training are more, so that the calculation resources consumed by the deep learning are huge, and the learning efficiency is also low.
Disclosure of Invention
In view of this, the embodiment of the present invention provides an algorithm efficiency improving method based on a neural network, which is used for solving the problem that the existing indoor garbage detection and identification neural network algorithm consumes huge computing resources, resulting in poor learning and training efficiency. The indoor garbage image training system can train indoor partial garbage images, and then train in batches, so that the number of training layers is effectively reduced, and the training efficiency is improved.
The embodiment of the invention provides an algorithm efficiency improving method based on a neural network, which comprises the following steps:
collecting a preset number of indoor garbage images to obtain a training sample set;
training a preset indoor garbage detection neural network by using the training sample set;
collecting a plurality of indoor images of the specified garbage to obtain an image set corresponding to the specified garbage, and adding a garbage type label to the indoor images of the specified garbage;
and performing deep learning on the image set corresponding to each type of garbage based on the trained indoor garbage detection neural network to obtain the characteristic data of each type of garbage.
In an optional embodiment, the acquiring a preset number of indoor garbage images includes:
collecting a preset number of indoor garbage images through a preset control circuit;
the preset control circuit comprises a power supply, a key, a relay, a self-locking switch, an image acquisition device and a CPU; the output end of the power supply is sequentially connected with the self-locking switch and the image acquisition device in series; the positive output end of the power supply is also sequentially connected with the key and the relay in series; the output end of the relay is connected with the switch triggering end of the self-locking switch; the output end of the image acquisition device is connected with the CPU, the CPU is provided with a first IO pin and a second IO pin, the first IO pin is connected with the switch trigger end of the relay, and the second IO pin is connected with the anode output end of the power supply through the key.
In an optional embodiment, the acquiring, by the preset control circuit, a preset number of indoor garbage images includes:
controlling the control circuit to be in an initial state; the initial state is as follows: the key is in an off state, the relay is in a closed state, the self-locking switch is in an off state, the first IO pin is at a low level, and the second IO pin is at a low level;
sending a first pulse signal formed by clicking the key to a switch trigger end of the self-locking switch through the relay;
the self-locking switch is closed in a self-locking mode according to the first pulse signal, so that the image acquisition device is powered;
collecting indoor rubbish images through the image collecting device;
when the indoor garbage image acquired by the image acquisition device meets a preset power supply condition, supplying power to the CPU through the image acquisition device;
controlling the first IO pin to be in a high level, so that the relay is converted into an off state according to the high level of the first IO pin;
and acquiring indoor garbage images in real time through the image acquisition device and sending the indoor garbage images to the CPU, so that the CPU executes the step of training a preset indoor garbage detection neural network by taking the training sample set as a training sample after obtaining the training sample set.
In an optional embodiment, the method further comprises:
detecting the power supply states of the image acquisition device and the CPU in real time;
controlling the state of an indicator light preset at the key according to the power supply states of the image acquisition device and the CPU so as to remind a user of the current indoor garbage detection state; wherein, indoor rubbish detection state includes: indoor rubbish detection is currently carried out, the current image acquisition device is started but indoor rubbish detection is not carried out, and the current image acquisition device is not started and indoor rubbish detection is not carried out.
In an optional embodiment, when the indoor garbage image collected by the image collecting device meets a preset power supply condition, the supplying power to the CPU through the image collecting device includes:
calculating a power supply control value of the CPU at the current moment based on a first formula according to the indoor garbage image acquired by the image acquisition device at the current moment;
judging whether the power supply control value of the CPU at the current moment is equal to 1 or not;
if the power supply control value of the CPU at the current moment is equal to 1, determining that the indoor garbage image acquired by the image acquisition device meets a preset power supply condition, and supplying power to the CPU through the image acquisition device;
wherein the first formula is:
Figure BDA0003567538220000031
in the first formula, E (t _ CPU) represents a power supply control value of the CPU at the current moment; t is the current time; e (t _ D) represents a power supply value of the image acquisition device at the current moment, if the image acquisition device is powered on, E (t _ D) =1, otherwise E (t _ D) =0; h (i, j) represents the pixel value of the ith row and jth column of pixel points in the indoor garbage image collected by the image collecting device at the current moment; u [ ] represents a normalization function, and if the value in the parentheses is not 0, the function value is 1, otherwise the function value is 0; j =1,2, \8230;, m; m represents the total number of pixel points of each line in the indoor garbage image collected by the image collecting device at the current moment; i =1,2, \8230n; n represents the total number of pixel points of each column in the indoor garbage image collected by the image collecting device at the current moment; f { } represents a negative number test function, if the value in the brackets is a negative number, the function value is 1, otherwise, the function value is 0;
according to the power supply state of image acquisition device and CPU, control the pilot lamp state of presetting in button department includes:
calculating a current state control value of the indicator lamp according to a second formula;
controlling the state of the indicator light to be the state corresponding to the current state control value according to the corresponding relation between the preset state control value and the state of the indicator light;
wherein the second formula is:
Figure BDA0003567538220000041
in the second formula, R (t) represents the current state control value of the indicator light at the current moment; Λ represents the logical relationship and.
In an optional embodiment, after the image capturing device captures an indoor garbage image in real time and sends the indoor garbage image to the CPU, so that the CPU obtains a training sample set, the method further includes:
when the long-time pressing duration of the key reaches a preset duration, controlling the first IO pin to be converted from a high level to a low level, so that the relay is converted into a closed state according to the low level of the first IO pin;
when the key is pressed for a long time, a second pulse signal formed by the fact that the key is pressed for a long time is sent to a switch trigger end of the self-locking switch through the relay, and meanwhile, the second IO pin is converted into a low level;
and the self-locking switch is switched into a disconnected state according to the second pulse signal, and the power supply of the image acquisition device to the CPU is switched off, so that the control circuit is returned to an initial state.
In an optional embodiment, the predetermined time is 5s;
when the length of time that the button is pressed for a long time reaches a predetermined length of time, controlling the first IO pin to change from a high level to a low level includes:
receiving the operation that the key is pressed down, and continuously detecting the level state of the second IO pin at each moment from the moment when the key is pressed down;
calculating a level control value of the first IO pin at the current moment according to a third formula;
judging whether the level control value of the first IO pin at the current moment is equal to 0 or not;
if the level control value of the first IO pin at the current moment is equal to 0, controlling the first IO pin to be converted from a high level to a low level;
wherein the third formula is:
Figure BDA0003567538220000051
in the third formula, C IO1 (t) representing a level control value of the first IO pin at the current moment; s IO2 (t) indicating a level receiving value of the second IO pin at the current moment, wherein if the second IO pin receives a high level, the level receiving value is 1, otherwise, the level receiving value is 0; a represents an integer variable with a value range of [1,5 ]](ii) a And | | represents the absolute value.
In an alternative embodiment, the acquiring a plurality of images of the specified kind of garbage in the room comprises:
placing the garbage of the specified kind indoors;
and a plurality of images of the garbage of the specified type in the room are acquired through the control circuit.
The invention provides an algorithm efficiency improving method based on a neural network, which comprises the steps of firstly, collecting indoor preset quantity of garbage images for training to obtain a trained neural network; and then, collecting indoor garbage pictures of different types, and giving the trained neural network in batches according to the type of the garbage to perform deep learning to obtain the characteristic data of each type of garbage. The indoor garbage image training system can train indoor partial garbage images and then train in batches, effectively reduces the number of training layers and improves the training efficiency.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a flowchart illustrating an embodiment of a method for improving efficiency of an algorithm based on a neural network according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a default control circuit;
fig. 3 is a flowchart of an embodiment of an algorithm efficiency improving method based on a neural network according to the present invention.
Detailed Description
Embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
It should be understood that the described embodiments are only some embodiments of the invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a flowchart of an embodiment of an algorithm efficiency improving method based on a neural network according to an embodiment of the present invention. Referring to fig. 1, the method includes the following steps S101-S104:
s101: and collecting a preset number of indoor garbage images to obtain a training sample set.
In the embodiment, indoor department spam images are collected as training sample sets, so that the indoor department spam images can be conveniently and subsequently provided for an indoor spam detection neural network to train.
S102: and training a preset indoor garbage detection neural network by using the training sample set.
In the embodiment, part of the garbage images are used as the training sample set, the training efficiency of the indoor garbage detection neural network is effectively improved along with the reduction of the number of the images in the training sample set, more universal garbage characteristic data can be quickly obtained, and whether indoor articles are garbage or not can be quickly identified by the trained neural network.
S103: the method comprises the steps of collecting a plurality of indoor images of specified types of garbage to obtain an image set corresponding to the specified types of garbage, and adding garbage type labels to the indoor images of the specified types of garbage.
In this embodiment, the current garbage category mainly includes: the recyclable garbage, kitchen garbage, harmful garbage and other garbage can be classified into 4 types, and can be subdivided into five types, namely waste paper, plastic, glass, metal and cloth. A plurality of indoor images are classified according to the garbage types, so that the images can be subsequently provided for the trained neural network to further train, and the garbage detection accuracy of the neural network and the comprehensiveness of detection result information are improved.
S104: and performing deep learning on the image set corresponding to each type of garbage based on the trained indoor garbage detection neural network to obtain the characteristic data of each type of garbage.
In this embodiment, the trained indoor spam detection neural network already obtains general spam feature data, and further performs deep learning on an image set corresponding to each type of spam, so as to obtain feature data of each type of spam. Through the training again, the neural network can not only identify the indoor garbage, further identify the type of the garbage. The training in batches not only improves the training efficiency, but also improves the performance of the neural network.
As an alternative embodiment, in step S101, a preset number of indoor garbage images may be collected through a preset control circuit. As shown in fig. 2, the preset control circuit includes a power supply 21, a key 22, a relay 23, a self-locking switch 24, an image acquisition device 25 and a CPU26; the output end of the power supply 21 is sequentially connected with a self-locking switch 24 and an image acquisition device 25 in series; the anode output end of the power supply 21 is also sequentially connected with a key 22 and a relay 23 in series; the output end of the relay 23 is connected with the switch triggering end of the self-locking switch 24; the output end of the image acquisition device 25 is connected with the CPU26, the CPU26 has a first IO pin 27 and a second IO pin 28, the first IO pin 27 is connected with the switch trigger end of the relay 23, and the second IO pin 28 is connected with the positive output end 21 of the power supply through the key 22.
In this embodiment, the CPU is used for calculating the neural network, and the image acquisition device is used for acquiring an indoor photograph. The preset control circuit provided herein will help to implement the neural network-based algorithm efficiency improvement method provided by the present invention.
According to the algorithm efficiency improving method based on the neural network, provided by the embodiment of the invention, firstly, indoor preset quantity of garbage images are collected for training to obtain a trained neural network; and then, collecting indoor garbage pictures of different types, and giving the indoor garbage pictures to the trained neural network in batches according to the type of the garbage to be subjected to deep learning to obtain the characteristic data of the garbage of each type. The invention can train indoor partial garbage images and then train in batches, effectively reduces the number of training layers and improves the training efficiency and the accuracy of trained neural networks.
Fig. 3 is a flowchart of an embodiment of an algorithm efficiency improving method based on a neural network according to the present invention. Referring to fig. 3, the method includes the following steps S201 to S211:
s201: and controlling the control circuit to be in an initial state.
The initial state of the control circuit is as follows: the key 22 is in an open state, the relay 23 is in a closed state, the latching switch 24 is in an open state, the first IO pin 27 is at a low level, and the second IO pin 28 is at a low level. In the initial state, the latching switch 24 is in the off state, the CPU26 is not powered, and therefore both the first IO pin 27 and the second IO pin 28 of the CPU are low.
S202: a first pulse signal formed as a result of the button 22 being clicked is sent to the switch trigger terminal of the latching switch 24 through the relay 23.
In this step, when indoor garbage detection is required, a user needs to click the button 22, a first pulse signal (rising edge pulse signal) is formed due to the operation of clicking the button 22, and the relay 23 sends the first pulse signal to the self-locking switch 24.
S203: the self-locking switch 24 is closed in a self-locking way according to the first pulse signal, so that the image acquisition device 25 is powered.
In this embodiment, the first pulse signal is a closing trigger signal of the self-locking switch 24, and the second pulse signal is an opening trigger signal of the self-locking switch 24. When indoor garbage detection is needed, a user needs to press the key 22, the relay 23 sends a first pulse signal to the self-locking switch 24, at the moment, the self-locking switch 24 is closed in a self-locking mode according to the first pulse signal, a circuit between the image acquisition device 25 and the power supply 21 is connected, and the image acquisition device 25 is powered.
S204: the indoor garbage image is collected by the image collecting device 25.
In this step, after the power of the image acquisition device 25 is turned on, the image of the indoor garbage starts to be acquired.
S205: when the indoor garbage image collected by the image collecting device 25 meets the preset power supply condition, power is supplied to the CPU26 through the image collecting device 25.
In this embodiment, when the image acquisition device collects indoor garbage images and accumulates to a certain amount, the power supply is supplied to the CPU, so that the CPU starts to perform the calculation of the neural network according to the collected indoor garbage images, and it is ensured that the power supply of the CPU can be turned off when the garbage images do not accumulate to a certain degree, thereby effectively saving the power consumption of the CPU.
S206: the first IO pin 27 is controlled to be high level, so that the relay 23 is turned to the off state according to the high level of the first IO pin 27.
In this embodiment, after the CPU26 is powered on, the first IO pin 27 is controlled to change from a low level to a high level, the switch of the relay 23 is turned off after receiving a high level signal, and the user clicks the key 22 again, so that an error caused by mistakenly touching the key 22 when the CPU performs a neural network algorithm is avoided.
S207: the indoor garbage image is collected in real time by the image collecting device 25 and sent to the CPU26, so that the CPU26 obtains a training sample set.
S208: after the CPU26 obtains the training sample set, the training sample set is used as a training sample to train a preset indoor spam detection neural network.
S209: the specified kind of garbage is placed indoors.
S210: the control circuit is used for acquiring a plurality of indoor images of the specified garbage to obtain an image set corresponding to the specified garbage, and adding garbage type labels to the indoor images of the specified garbage.
In this step, the specific method for acquiring the images of the garbage of the designated type in the room by the control circuit is similar to the above steps S201 to S207, and is not described herein again.
S211: and performing deep learning on the image set corresponding to each type of rubbish based on the trained indoor rubbish detection neural network to obtain the feature data of each type of rubbish.
In the second embodiment, when indoor garbage detection is required, the image acquisition device can be triggered to start working through the keys of the control circuit, and the CPU is switched on to perform calculation of the neural network when the indoor garbage amount is accumulated to a certain amount, so that the workload efficiency of the CPU during operation can be ensured to be high, and the power supply of the CPU can be turned off to save power consumption when the garbage is accumulated.
As an alternative embodiment, the method for improving algorithm efficiency based on a neural network provided by the present invention may further include the following steps:
s212: the power supply states of the image pickup device 25 and the CPU26 are detected in real time.
S213: and according to the power supply states of the image acquisition device 25 and the CPU26, the state of an indicator light preset at the key 22 is controlled to remind a user of the current indoor garbage detection state.
Wherein, indoor rubbish detection state includes: indoor rubbish detection is currently carried out, the current image acquisition device is started but indoor rubbish detection is not carried out, and the current image acquisition device is not started and indoor rubbish detection is not carried out.
In this embodiment, it is envisioned that an indicator light is disposed at the control key 22 or on the human-computer interface, and the state of the indicator light of the control key is controlled according to the power supply states of the image acquisition device and the CPU, so as to remind the user of subsequent control operation of the key, thereby facilitating the use of the user.
As an alternative embodiment, the step S205 may include the following steps S2051 to S2053:
s2051: and calculating the power supply control value of the CPU at the current moment based on a first formula according to the indoor garbage image acquired by the image acquisition device at the current moment.
Preferably, the first formula is:
Figure BDA0003567538220000091
in the first formula, E (t _ CPU) represents a power supply control value of the CPU at the current moment; t is the current time; e (t _ D) represents a power supply value of the image acquisition device at the current moment, if the image acquisition device is powered on, E (t _ D) =1, otherwise E (t _ D) =0; h (i, j) represents the pixel value of the ith row and jth column of pixel points in the indoor garbage image collected by the image collecting device at the current moment; u [ ] represents a normalization function, and if the value in the parentheses is not 0, the function value is 1, otherwise the function value is 0; j =1,2, \ 8230;, m; m represents the total number of pixel points of each line in the indoor garbage image collected by the image collecting device at the current moment; i =1,2, \8230n; n represents the total number of pixel points of each column in the indoor garbage image collected by the image collecting device at the current moment; f { } represents a negative number check function, and if the value in the parentheses is a negative number, the function value is 1, otherwise the function value is 0.
S2052: and judging whether the power supply control value of the CPU at the current moment is equal to 1, if so, executing S2053.
In this embodiment, if E (t _ CPU) =1, it means that it is necessary to control to flow a voltage into the CPU; if E (t _ CPU) =0, it means that the voltage does not need to be controlled to flow into the CPU, that is, the voltage only flows into the CPU when a certain condition must be met, so that the working pressure of the CPU is effectively reduced, and the service life of the CPU is prolonged.
S2053: and determining that the indoor garbage image acquired by the image acquisition device 25 meets the preset power supply condition, and supplying power to the CPU26 through the image acquisition device 25.
In this embodiment, the power supply of the CPU is controlled according to the image acquired by the image acquisition device, so that the neural network calculation is performed when the indoor garbage image is accumulated to a certain amount, which not only can ensure high work efficiency of the CPU during operation, but also can ensure that the power supply of the CPU is turned off to save power consumption when the garbage image is accumulated.
As an alternative embodiment, step S213 may include the following steps S2131 to S2132:
s2131: and calculating the current state control value of the indicator lamp according to a second formula.
Preferably, the second formula is:
Figure BDA0003567538220000101
in the second formula, R (t) represents the current state control value of the indicator lamp at the current moment; Λ represents a logical relationship.
S2132: and controlling the state of the indicator light to be the state corresponding to the current state control value according to the corresponding relation between the preset state control value and the state of the indicator light.
In this embodiment, if R (t) =1, the status of the indicator light of the key may be controlled to be normally on, that is, the user is reminded that indoor garbage detection has started currently, and indoor garbage detection may be stopped only by pressing the key for a long time; if R (t) = -1, the state of an indicator light of the key can be controlled to flicker, namely, a user is reminded that the current image acquisition device is started but indoor garbage detection is not performed, and the image acquisition device and subsequent operation can be stopped by clicking the key; if R (t) =0, the state of the indicator light of the key can be controlled to be off, namely, a user is reminded that the current image acquisition device and indoor garbage detection are not performed, and the image acquisition device and subsequent indoor garbage detection can be started by clicking the key. The state of the indicator light of the key is controlled according to the power supply states of the image acquisition device and the CPU, so that a user is reminded of follow-up control operation of the key, and the key is convenient to use.
As an alternative embodiment, after step S207 in fig. 2, the following steps S2071 to S2073 may be further included:
s2071: when the key 22 is pressed for a long time period of a predetermined time period, the first IO pin 27 is controlled to be changed from the high level to the low level, so that the relay 23 is changed to the off state according to the low level of the first IO pin 27.
In this embodiment, after the CPU26 is powered in S206, the first IO pin 27 is switched to the high level, so that the relay 23 is turned off, after the CPU26 acquires a suitable number of indoor spam images in S207, if indoor spam detection needs to be stopped, the user may press the key 22 for a long time, and if the time for which the user presses the key 22 exceeds a predetermined time, the first IO pin 27 is controlled to be switched from the high level to the low level, so that the relay 23 is switched to the off state according to the low level of the first IO pin 27.
S2072: when the key 22 is pressed for a long time to end, the second pulse signal formed by the key 22 being pressed for a long time to end is sent to the switch trigger terminal of the latching switch 24 through the relay 23, and the second IO pin 28 goes low.
S2073: the self-locking switch 24 is turned to an off state according to the second pulse signal, and the power supply of the image acquisition device 25 to the CPU26 is turned off, so that the control circuit returns to an initial state.
Preferably, the predetermined time period is 5S, and the method for controlling the first IO pin 27 to switch from the high level to the low level when the key 22 is pressed for a long time period to reach the predetermined time period in step S2071 may include:
s20711: the operation of pressing the key 22 is received, and the level state of the second IO pin 28 is continuously detected at each time from the time when the key 22 is pressed.
S20712: and calculating the level control value of the first IO pin 27 at the current moment according to a third formula.
Wherein the third formula is:
Figure BDA0003567538220000121
in the third formula, C IO1 (t) representing a level control value of the first IO pin at the current moment; s. the IO2 (t) represents a level receiving value of the second IO pin at the current moment, wherein if the second IO pin receives a high level, the level receiving value is 1, otherwise, the level receiving value is 0; a represents an integer variable with a value range of [1,5 ]](ii) a And | | represents taking the absolute value.
S20713: judging whether the level control value of the first IO pin 27 at the current moment is equal to 0; if yes, S20714 is executed.
And S20714, controlling the first IO pin 27 to go from high to low.
In this embodiment, the pin level of IO1 is controlled according to the pressing time of the key, that is, the time of the high level received by the IO2 pin, so that the error touch of a user when the CPU performs a neural network algorithm is avoided, and the security of the system is ensured. The key pressing time of a user exceeds 5s, namely, the key closing time exceeds 5s, namely, the high level time received by the IO2 pin exceeds 5s, the user is determined to stop indoor rubbish detection, then the pin of the IO1 port is controlled to be low level so as to close the relay again, when the user leaves the key, the self-locking switch can receive a falling edge signal to be disconnected, and then the power supply of the image acquisition device and the CPU is turned off, so that the work load efficiency of the CPU in operation can be ensured to be high, and the power supply of the CPU can be turned off to save power consumption in rubbish accumulation.
According to the algorithm efficiency improving method based on the neural network, the CPU is started to start training of the indoor rubbish detection neural network when indoor rubbish pictures are accumulated to a certain degree, so that the work load efficiency of the CPU during operation can be guaranteed to be high, and the power supply of the CPU can be turned off to save power consumption when the rubbish pictures are accumulated.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations. The above description is only for the specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (5)

1. An algorithm efficiency improving method based on a neural network is characterized by comprising the following steps:
acquiring a preset number of indoor garbage images to obtain a training sample set;
training a preset indoor garbage detection neural network by using the training sample set;
collecting a plurality of images of the specified garbage in a room to obtain an image set corresponding to the specified garbage, and adding a garbage type label to the images of the specified garbage in the room;
deep learning is carried out on an image set corresponding to each type of garbage based on the trained indoor garbage detection neural network, and feature data of each type of garbage are obtained;
wherein, gather the indoor rubbish image of predetermineeing quantity, include:
collecting a preset number of indoor garbage images through a preset control circuit;
the preset control circuit comprises a power supply, a key, a relay, a self-locking switch, an image acquisition device and a CPU; the output end of the power supply is sequentially connected with the self-locking switch and the image acquisition device in series; the positive output end of the power supply is also sequentially connected with the key and the relay in series; the output end of the relay is connected with the switch triggering end of the self-locking switch; the output end of the image acquisition device is connected with the CPU, the CPU is provided with a first IO pin and a second IO pin, the first IO pin is connected with the switch trigger end of the relay, and the second IO pin is connected with the positive output end of the power supply through the key;
wherein, gather the indoor rubbish image of predetermineeing quantity through predetermineeing control circuit, include:
controlling the control circuit to be in an initial state; the initial state is as follows: the key is in an off state, the relay is in a closed state, the self-locking switch is in an off state, the first IO pin is at a low level, and the second IO pin is at a low level;
sending a first pulse signal formed by clicking the key to a switch trigger end of the self-locking switch through the relay;
the self-locking switch is closed in a self-locking mode according to the first pulse signal, so that the image acquisition device is powered;
collecting indoor rubbish images through the image collecting device;
when the indoor garbage image acquired by the image acquisition device meets a preset power supply condition, supplying power to the CPU through the image acquisition device;
controlling the first IO pin to be in a high level, so that the relay is converted into an off state according to the high level of the first IO pin;
acquiring indoor garbage images in real time through the image acquisition device and sending the indoor garbage images to the CPU, so that the CPU can execute the step of training a preset indoor garbage detection neural network by taking the training sample set as a training sample after obtaining the training sample set;
wherein, when the indoor rubbish image of image acquisition device collection satisfies when predetermineeing the power supply condition, pass through image acquisition device to the CPU power supply includes:
calculating a power supply control value of the CPU at the current moment based on a first formula according to the indoor garbage image acquired by the image acquisition device at the current moment;
judging whether the power supply control value of the CPU at the current moment is equal to 1;
if the power supply control value of the CPU at the current moment is equal to 1, determining that the indoor garbage image acquired by the image acquisition device meets a preset power supply condition, and supplying power to the CPU through the image acquisition device;
wherein the first formula is:
Figure FDA0003901173330000021
in the first formula, E (t _ CPU) represents a power supply control value of the CPU at the current moment; t is the current time; e (t _ D) represents a power supply value of the image acquisition device at the current moment, if the image acquisition device is powered on, E (t _ D) =1, otherwise E (t _ D) =0; h (i, j) represents the pixel value of the ith row and jth column of pixel points in the indoor garbage image collected by the image collecting device at the current moment; u [ ] represents a normalization function, and if the value in the parentheses is not 0, the function value is 1, otherwise the function value is 0; j =1,2, \ 8230;, m; m represents the total number of pixel points of each line in the indoor garbage image collected by the image collecting device at the current moment; i =1,2, \ 8230n; n represents the total number of pixel points of each column in the indoor garbage image collected by the image collecting device at the current moment; f { } represents a negative number test function, if the value in the brackets is a negative number, the function value is 1, otherwise, the function value is 0;
according to the power supply state of image acquisition device and CPU, control the pilot lamp state of presetting in button department includes:
calculating a current state control value of the indicator lamp according to a second formula;
controlling the state of the indicator light to be a state corresponding to the current state control value according to the corresponding relation between the preset state control value and the state of the indicator light;
wherein the second formula is:
Figure FDA0003901173330000031
in the second formula, R (t) represents the current state control value of the indicator lamp at the current moment; Λ represents the logical relationship and.
2. The neural network-based algorithmic efficiency boosting method of claim 1, said method further comprising:
detecting the power supply states of the image acquisition device and the CPU in real time;
controlling the state of an indicator light preset at the key according to the power supply states of the image acquisition device and the CPU so as to remind a user of the current indoor garbage detection state; wherein, indoor rubbish detection state includes: indoor rubbish detection is currently carried out, the current image acquisition device is started but indoor rubbish detection is not carried out, and the current image acquisition device is not started and the indoor rubbish detection is not carried out.
3. The method for improving algorithm efficiency based on neural network as claimed in claim 1, wherein after the indoor garbage image is collected in real time by the image collecting device and sent to the CPU, so that the CPU obtains a training sample set, further comprising:
when the long-time pressing duration of the key reaches a preset duration, controlling the first IO pin to be converted from a high level to a low level, so that the relay is converted into a closed state according to the low level of the first IO pin;
when the key is pressed for a long time, a second pulse signal formed by the fact that the key is pressed for a long time is sent to a switch trigger end of the self-locking switch through the relay, and meanwhile, the second IO pin is converted into a low level;
and the self-locking switch is switched to a disconnected state according to the second pulse signal, and the power supply of the image acquisition device to the CPU is switched off, so that the control circuit is returned to the initial state.
4. The neural network-based algorithmic efficiency boosting method of claim 3, wherein the predetermined duration is 5s;
when the length of time that the button is pressed for a long time reaches a predetermined length of time, controlling the first IO pin to change from a high level to a low level includes:
receiving the operation that the key is pressed, and continuously detecting the level state of the second IO pin at each moment from the moment when the key is pressed;
calculating a level control value of the first IO pin at the current moment according to a third formula;
judging whether the level control value of the first IO pin at the current moment is equal to 0;
if the level control value of the first IO pin at the current moment is equal to 0, controlling the first IO pin to be converted from a high level to a low level;
wherein the third formula is:
Figure FDA0003901173330000041
in the third formula, C IO1 (t) represents a level control value of the first IO pin at the present moment; s IO2 (t) represents a level receiving value of the second IO pin at the current moment, wherein if the second IO pin receives a high level, the level receiving value is 1, otherwise, the level receiving value is 0; a represents an integer variable with a value range of [1,5 ]](ii) a And | | represents the absolute value.
5. The neural network-based algorithmic efficiency enhancement method of any of claims 1 to 4, wherein said capturing a number of images of a given kind of garbage indoors comprises:
placing the garbage of the specified kind indoors;
and a plurality of images of the garbage of the specified type in the room are collected through the control circuit.
CN202210312297.XA 2022-03-28 2022-03-28 Algorithm efficiency improving method based on neural network Active CN114821264B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210312297.XA CN114821264B (en) 2022-03-28 2022-03-28 Algorithm efficiency improving method based on neural network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210312297.XA CN114821264B (en) 2022-03-28 2022-03-28 Algorithm efficiency improving method based on neural network

Publications (2)

Publication Number Publication Date
CN114821264A CN114821264A (en) 2022-07-29
CN114821264B true CN114821264B (en) 2023-02-17

Family

ID=82531413

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210312297.XA Active CN114821264B (en) 2022-03-28 2022-03-28 Algorithm efficiency improving method based on neural network

Country Status (1)

Country Link
CN (1) CN114821264B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108932510A (en) * 2018-08-20 2018-12-04 贵州宜行智通科技有限公司 A kind of rubbish detection method and device
CN109201514A (en) * 2017-06-30 2019-01-15 京东方科技集团股份有限公司 Waste sorting recycle method, garbage classification device and classified-refuse recovery system
CN111445368A (en) * 2020-03-16 2020-07-24 五邑大学 Garbage classification method, device and equipment based on machine vision and deep learning
CN211718725U (en) * 2020-01-15 2020-10-20 安徽农业大学 Indoor power supply control system based on raspberry group
CN112926670A (en) * 2021-03-11 2021-06-08 广东邮电职业技术学院 Garbage classification system and method based on transfer learning
CN114239667A (en) * 2020-09-08 2022-03-25 上海永力信息科技股份有限公司 Garbage detection classification and inference method based on deep learning

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019079883A1 (en) * 2017-10-24 2019-05-02 Waterloo Controls Inc. Systems and methods for detecting waste receptacles using convolutional neural networks
CN109928107B (en) * 2019-04-08 2022-11-29 江西理工大学 Automatic classification system
CN110569737A (en) * 2019-08-15 2019-12-13 深圳华北工控软件技术有限公司 Face recognition deep learning method and face recognition acceleration camera
CN110654740A (en) * 2019-09-26 2020-01-07 五邑大学 Method, device and storage medium for automatically classifying garbage
US11335086B2 (en) * 2020-03-21 2022-05-17 Fidelity Ag, Inc. Methods and electronic devices for automated waste management
CN112487938A (en) * 2020-11-26 2021-03-12 南京大学 Method for realizing garbage classification by utilizing deep learning algorithm
CN112364944B (en) * 2020-12-18 2022-07-05 福州大学 Deep learning-based household garbage classification method
CN114187470A (en) * 2021-11-12 2022-03-15 中原动力智能机器人有限公司 Training method of garbage classification model, garbage classification method and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109201514A (en) * 2017-06-30 2019-01-15 京东方科技集团股份有限公司 Waste sorting recycle method, garbage classification device and classified-refuse recovery system
CN108932510A (en) * 2018-08-20 2018-12-04 贵州宜行智通科技有限公司 A kind of rubbish detection method and device
CN211718725U (en) * 2020-01-15 2020-10-20 安徽农业大学 Indoor power supply control system based on raspberry group
CN111445368A (en) * 2020-03-16 2020-07-24 五邑大学 Garbage classification method, device and equipment based on machine vision and deep learning
CN114239667A (en) * 2020-09-08 2022-03-25 上海永力信息科技股份有限公司 Garbage detection classification and inference method based on deep learning
CN112926670A (en) * 2021-03-11 2021-06-08 广东邮电职业技术学院 Garbage classification system and method based on transfer learning

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
基于卷积神经网络的垃圾分类研究;秦斌斌等;《无线通信技术》;20190915(第03期);正文第51-56页 *
基于迁移学习的可回收生活垃圾图像分类识别研究;郑誉煌等;《广东第二师范学院学报》;20200611(第03期);正文第94-100页 *

Also Published As

Publication number Publication date
CN114821264A (en) 2022-07-29

Similar Documents

Publication Publication Date Title
CN110119662A (en) A kind of rubbish category identification system based on deep learning
CN111128157B (en) Wake-up-free voice recognition control method for intelligent household appliance, computer readable storage medium and air conditioner
CN104616002A (en) Facial recognition equipment used for judging age groups
CN107270654A (en) A kind of message prompt method and intelligent refrigerator
CN112634894A (en) Awakening method, awakening device and terminal
CN102902954A (en) Pedestrian detection system and method based on internet-of-things intelligent household security gateway
CN111243742A (en) Intelligent glasses capable of analyzing eye habits of children
CN114821264B (en) Algorithm efficiency improving method based on neural network
CN118226967A (en) Multi-mode interaction intelligent control system
CN117689278A (en) Construction quality intelligent management system and method
CN112843425B (en) Sleeping posture detection method and device based on sleeping pillow, electronic equipment and storage medium
CN207147050U (en) A kind of intelligent refrigerator and intelligent refrigerator system
CN111179924B (en) Method and system for optimizing awakening performance based on mode switching
CN106707741B (en) Electrical equipment control method and device
CN106873836A (en) The control method and device of terminal
CN113378627B (en) Automatic garbage classification method and device based on DSP chip and single chip microcomputer control
CN111077783A (en) Household appliance customized control system and method and customized action processing system and method
CN212244726U (en) Intelligent classification garbage bin
CN112153279A (en) Intelligent device false wake-up filtering method and system
WO2018035677A1 (en) Method and device for scanning two-dimensional barcode
CN115529530B (en) Intelligent control method for internal functions of multifunctional mobile power supply sound box
CN205621024U (en) Face detection identification system based on embedded platform
CN113129464B (en) Office equipment automatic control method, office equipment automatic control device, office equipment automatic control server and storage medium
CN116301424B (en) Touch recognition system based on pressure touch sensor
CN211086175U (en) Bionic olfaction acquisition and recognition system

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