CN110378479B - Image input method and device based on deep learning and terminal equipment - Google Patents

Image input method and device based on deep learning and terminal equipment Download PDF

Info

Publication number
CN110378479B
CN110378479B CN201910500560.6A CN201910500560A CN110378479B CN 110378479 B CN110378479 B CN 110378479B CN 201910500560 A CN201910500560 A CN 201910500560A CN 110378479 B CN110378479 B CN 110378479B
Authority
CN
China
Prior art keywords
training
pictures
queue
picture
occupancy rate
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
CN201910500560.6A
Other languages
Chinese (zh)
Other versions
CN110378479A (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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201910500560.6A priority Critical patent/CN110378479B/en
Publication of CN110378479A publication Critical patent/CN110378479A/en
Application granted granted Critical
Publication of CN110378479B publication Critical patent/CN110378479B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • 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

Abstract

The invention is suitable for the technical field of data processing, and provides a picture input method, a device, terminal equipment and a computer readable storage medium based on deep learning, wherein the method comprises the following steps: acquiring a preset threshold index; repeating the selection of training pictures under the candidate path until the selected training pictures reach the threshold indicator; creating a buffer queue, and adding the selected training pictures to the buffer queue; creating a queue reading object, reading the training pictures in the buffer queue through the queue reading object, and decoding the read training pictures to obtain training tensor data; creating a thread manager object and adding all the training tensor data to a call queue through the thread manager object, wherein the training tensor data in the call queue are used for being called by a deep learning network. According to the invention, the pictures are input in batches, so that the stability of picture training is improved.

Description

Image input method and device based on deep learning and terminal equipment
Technical Field
The invention belongs to the technical field of data processing, and particularly relates to a picture input method and device based on deep learning, terminal equipment and a computer readable storage medium.
Background
With the development of computer technology and mathematical ideas, deep learning, which is a way to perform characterization learning on data, has been widely used since being developed to replace the work of manually acquiring features. When training a deep learning network, data to be trained is first input to the deep learning network.
In a scene that a training object is a picture, in the prior art, all pictures to be trained are converted into data matrixes and are uniformly input into a deep learning network for processing, that is, all image matrix data are called when the deep learning network is trained, so that the load of a computer is large, and a memory is easy to detonate. In summary, in the prior art, when a picture is input to the deep learning network, the memory is easily collapsed, and the training stability is poor.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for inputting a picture based on deep learning, a terminal device, and a computer-readable storage medium, so as to solve the problems in the prior art that a memory is easy to crash and stability is poor when a picture is input.
The first aspect of the embodiments of the present invention provides a picture input method based on deep learning, including:
acquiring a preset threshold index, wherein the threshold index is an index of a deep learning network capable of supporting input pictures in a batch of training;
repeatedly selecting a training picture under a candidate path until the selected training picture reaches the threshold index, wherein candidate pictures are stored under the candidate path;
creating a buffer queue, and adding the selected training picture to the buffer queue;
creating a queue reading object, reading the training pictures in the buffer queue through the queue reading object, and decoding the read training pictures to obtain training tensor data, wherein each training tensor data corresponds to one training picture;
creating a thread manager object, and adding all the training tensor data to a call queue through the thread manager object, wherein the training tensor data in the call queue is used for being called by the deep learning network.
A second aspect of an embodiment of the present invention provides a deep learning based picture input device, including:
the acquisition unit is used for acquiring a preset threshold index, wherein the threshold index is an index of a deep learning network capable of supporting input pictures in a batch of training;
the selecting unit is used for repeatedly selecting the training pictures under the candidate paths until the selected training pictures reach the threshold index, wherein the candidate paths store the candidate pictures;
the creating unit is used for creating a buffer queue and adding the selected training picture to the buffer queue;
the decoding unit is used for creating a queue reading object, reading the training pictures in the buffer queue through the queue reading object, and decoding the read training pictures to obtain training tensor data, wherein each training tensor data corresponds to one training picture;
and the adding unit is used for creating a thread manager object and adding all the training tensor data to a calling queue through the thread manager object, wherein the training tensor data in the calling queue is used for being called by the deep learning network.
A third aspect of the embodiments of the present invention provides a terminal device, where the terminal device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor executes the computer program to implement the following steps:
acquiring a preset threshold index, wherein the threshold index is an index of a deep learning network capable of supporting input pictures in a batch of training;
repeatedly selecting a training picture under a candidate path until the selected training picture reaches the threshold index, wherein candidate pictures are stored under the candidate path;
creating a buffer queue, and adding the selected training pictures to the buffer queue;
creating a queue reading object, reading the training pictures in the buffer queue through the queue reading object, and decoding the read training pictures to obtain training tensor data, wherein each training tensor data corresponds to one training picture;
creating a thread manager object, and adding all the training tensor data to a call queue through the thread manager object, wherein the training tensor data in the call queue is used for being called by the deep learning network.
A fourth aspect of embodiments of the present invention provides a computer-readable storage medium storing a computer program which, when executed by a processor, implements the steps of:
acquiring a preset threshold index, wherein the threshold index is an index of a deep learning network capable of supporting input pictures in a batch of training;
repeatedly selecting a training picture under a candidate path until the selected training picture reaches the threshold index, wherein candidate pictures are stored under the candidate path;
creating a buffer queue, and adding the selected training picture to the buffer queue;
creating a queue reading object, reading the training pictures in the buffer queue through the queue reading object, and decoding the read training pictures to obtain training tensor data, wherein each training tensor data corresponds to one training picture;
creating a thread manager object, and adding all the training tensor data to a call queue through the thread manager object, wherein the training tensor data in the call queue is used for being called by the deep learning network.
Compared with the prior art, the embodiment of the invention has the following beneficial effects:
the method and the device for the image input based on the split mode determine a batch of training images according to the threshold index, store the training images into the buffer queue, read the training images from the buffer queue and decode the training images, and finally add the decoded training tensor data to the calling queue for calling of the deep learning network.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
Fig. 1 is a flowchart of an implementation of a deep learning-based picture input method according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating an implementation of adjusting a threshold indicator according to resource occupancy according to an embodiment of the present invention;
FIG. 3 is a flow chart of an implementation of determining a new threshold indicator provided by an embodiment of the present invention;
FIG. 4 is a flow chart of an implementation of creating a buffer queue according to an embodiment of the present invention;
FIG. 5 is a flow chart of another implementation of creating a buffer queue according to an embodiment of the present invention;
FIG. 6 is a block diagram of a deep learning based picture input device according to an embodiment of the present invention;
fig. 7 is a schematic diagram of a terminal device according to an embodiment of the present invention.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the invention. It will be apparent, however, to one skilled in the art that the present invention may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present invention with unnecessary detail.
In order to explain the technical means of the present invention, the following description will be given by way of specific examples.
Fig. 1 shows an implementation process of a deep learning-based picture input method provided in an embodiment of the present invention, which is detailed as follows:
in S101, a preset threshold index is obtained, where the threshold index is an index that the deep learning network can support the input pictures in a batch of training.
The TensorFlow deep learning frame is an open-source frame based on data stream programming, has a multi-level structure, supports high-performance numerical calculation of a Graphics Processor (GPU) and a Tensor Processor (TPU), is widely applied to programming realization of various deep learning algorithms, can be deployed in various servers, personal computer terminals and web pages, and provides a deep learning-based picture input method for the picture input requirement in the TensorFlow deep learning frame.
When the pictures are input, firstly, a preset threshold index is obtained, wherein the threshold index is an index of the deep learning network based on the TensorFlow deep learning framework, which can support the input pictures in one training, and can be set in a user-defined manner according to an actual application scene. It is worth mentioning that the embodiment of the present invention does not limit the specific construction method and operation method of the deep learning network, and the embodiment of the present invention also does not limit the specific unit of the threshold index, for example, the threshold index may be the number of pictures, such as 100 pictures; may be a data volume, such as a 10MB (mega) picture; other units such as resolution may be added to the number of pictures or the data amount to form the threshold index, for example, 100 pictures with a resolution of 1280 × 720.
In S102, repeatedly selecting a training picture under a candidate path until the selected training picture reaches the threshold index, wherein a candidate picture is stored under the candidate path.
After the threshold index is obtained, selecting a training picture input into the deep learning network according to the threshold index, specifically, repeatedly selecting the training picture under the candidate path until the selected training picture reaches the threshold index, wherein the candidate path stores candidate pictures, the candidate path can be set by self definition in advance, and at least one candidate path exists in the embodiment of the invention. Since there may be at least two candidate pictures under the candidate path, a selection strategy for selecting the training picture under the candidate path may also be formulated, for example, the selection strategy may be set to perform random selection under the candidate path, or may be set to perform selection in the order from a to z according to the initials of the file names of the pictures, and the like. In addition, in order to prevent the same picture from being selected repeatedly, a selected flag may be set for the selected picture, and the picture with the selected flag is ignored in the subsequent selection process.
Optionally, all pictures conforming to the preset picture format are retrieved, and the path of the retrieved pictures is determined as a candidate path. Besides setting the candidate path in a user-defined manner, the embodiment of the invention can also realize automatic determination of the candidate path, specifically, the candidate path is retrieved in all file directories of the terminal device according to a preset picture format, and the retrieved picture path is determined as the candidate path, wherein the preset picture format such as jpg, png or jpeg can be set according to the picture input requirement of the deep learning network. For example, if the preset picture format is jpg, the file name of a picture is retrieved as "example. Jpg" according to the preset picture format, and the path of the picture is "/usr/admin/example1", then the path "/usr/admin/example1" is determined as a candidate path. By the method, manual operation is reduced, and the automation degree of setting the candidate path is improved.
In S103, a buffer queue is created, and the selected training picture is added to the buffer queue.
In order to manage the selected training pictures and enable the training pictures to be orderly input into the deep learning network, the picture input is carried out by applying a double-queue mode in the embodiment of the invention. In this step, a buffer queue is created, and the selected training pictures are added to the tail of the buffer queue, preferably in the same order as the selected training pictures. In addition, the maximum picture capacity of the file name queue can be set according to the threshold index, and excessive picture input is prevented from exceeding the load capacity of the terminal equipment.
In S104, a queue reading object is created, the training pictures in the buffer queue are read by the queue reading object, and the read training pictures are decoded to obtain training tensor data, where each training tensor data corresponds to one training picture.
Because the training pictures are still stored in the buffer queue, and in the tensors (tensors) deep learning framework, the deep learning network can only process tensor data, a queue reading object is created in the step, and particularly, the queue reading object can be created through a WholeFileReader function in the TensorFlow. After the creation is completed, reading out the training pictures in the buffer queue through the queue reading object, and decoding the read training pictures to obtain training tensor data which can be identified by the deep learning network, wherein each obtained training tensor data corresponds to one training picture. In the decoding process, a specific decoding function is determined according to the picture format of the training picture, and if the picture format of the training picture is gif, decoding can be performed through a decode _ gif function; if the picture format of the training picture is jpeg, decoding can be performed through a decode _ jpeg function.
Optionally, a reading threshold of the buffer queue is set, and the training pictures in the buffer queue are read according to the reading threshold. Since the training pictures may have a requirement for repeated training, for example, in the case of a small number of training pictures, when creating the buffer queue, a reading threshold may be set for the buffer queue, where the reading threshold indicates the number of times that the training pictures in the buffer queue are repeatedly read, and when the number of times that all the training pictures in the buffer queue are read reaches the reading threshold, the reading is stopped. The method ensures the training effect of the deep learning network in some special scenes, such as few-sample scenes.
In S105, a thread manager object is created, and all the training tensor data are added to a call queue through the thread manager object, where the training tensor data in the call queue are used for being called by the deep learning network.
In the embodiment of the present invention, a double-queue mode is applied to perform image input, and besides the buffer queue for buffering established in step S103, a call queue is also established for the deep learning network to call, where the call queue is a memory queue. Creating a thread manager object for the training tensor data decoded in the step S104, specifically creating through a train. In one implementation, the thread manager object is configured to manage at least two threads, and queue pushing of the training tensor data is performed through cooperation of the at least two threads, for example, the training tensor data a is added to a call queue through the thread a, and the training tensor data B is added to the call queue through the thread B, so that pushing efficiency is improved.
As can be seen from the embodiment shown in fig. 1, in the embodiment of the present invention, a training picture is selected in a candidate path through a preset threshold index, until the selected training picture reaches the threshold index, a buffer queue is created, the selected training picture is added to the buffer queue, then the training picture in the buffer queue is read by a queue reading object and is converted into training tensor data, and finally the training tensor data is added to a call queue through a thread manager object.
Fig. 2 is a flowchart illustrating an implementation of adjusting a threshold indicator according to resource occupancy according to an embodiment of the present invention, and may include the following steps:
in S201, the resource occupancy rate of the device resource when the deep learning network invokes the training tensor data is obtained.
In the foregoing method, it may be that, because the preset threshold index is inaccurate, the training process of a single batch of pictures is not matched with the load capability of the terminal device, and the training effect of the deep learning network is poor, so in the embodiment of the present invention, the resource occupancy rate of the device resource when the deep learning network calls all the training tensor data of a batch is obtained, where the device resource is a resource of the terminal device, and specifically includes at least one resource type, for example, the device resource may be a Central Processing Unit (CPU), a memory, or a combination of the CPU and the memory, which is not limited in the embodiment of the present invention. The specific acquisition mode of the resource occupancy rate is determined according to the actual application scenario, for example, the resource occupancy rates at different moments can be averaged to obtain the final resource occupancy rate during the period that the training tensor data of a batch are called; and determining the acquired resource occupancy rate with the maximum numerical value as the final resource occupancy rate when the training tensor data of a batch are called.
In S202, the threshold indicator is adjusted according to the resource occupancy.
And after the resource occupancy rate is obtained, adjusting the threshold index according to the resource occupancy rate. An adjustment method is that a threshold index is adjusted according to a proportional relation between a preset occupancy rate and a resource occupancy rate, for example, if the resource occupancy rate is 50%, the preset occupancy rate is 70%, and the original threshold index is 100MB, the ratio between the preset occupancy rate and the actual occupancy rate is 1.4, the ratio and the original threshold index are multiplied, and the result of the multiplication is determined as a new threshold index, namely 100 × 1.4=140mb, and then a next batch of training pictures can be selected according to the updated threshold index, so that the training load of the terminal device is more expected, and the situation that a batch of training pictures is too few or too many is avoided.
As can be seen from the embodiment shown in fig. 2, in the embodiment of the present invention, the resource occupancy rate when the deep learning network invokes the training tensor data is obtained, and the threshold index is adjusted according to the resource occupancy rate.
Fig. 3 is a flowchart illustrating an implementation of determining a new threshold indicator according to an embodiment of the present invention, and as shown in fig. 3, the method may include the following steps:
in S301, at least one occupancy interval is determined, each occupancy interval corresponding to a load proportion.
The embodiment of the invention also provides another mode for adjusting the threshold index. Specifically, at least one occupancy rate interval is determined, each occupancy rate interval includes a value range of resource occupancy rates, each occupancy rate interval corresponds to a preset load proportion, the load proportion indicates an adjustment proportion to a threshold index, and the occupancy rate interval and the load proportion can be set according to the device condition of the terminal device in an actual application scene.
In S302, in the at least one occupancy rate interval, a target occupancy rate interval corresponding to the resource occupancy rate is searched, the load proportion corresponding to the target occupancy rate interval is multiplied by the threshold indicator, and a result of the multiplication is determined as a new threshold indicator.
In the step, the occupancy rate interval corresponding to the acquired resource occupancy rate is searched, the product operation is performed on the load proportion corresponding to the occupancy rate interval and the current threshold index, the product operation result is determined as a new threshold index, and the next batch of training pictures are selected according to the new threshold index. For example, assuming that the device resource includes two resource types, namely a CPU and a memory, and the current threshold index is 100MB, the resource occupancy rate when the training tensor data is called is obtained, specifically { CPU occupancy rate 40%, memory occupancy rate 70% }, and an occupancy rate Interval is preset A Is { (CPU occupancy rate 20%, CPU occupancy rate 30%](memory occupancy rate is 40%, memory occupancy rate is 60%]The load ratio Index corresponding to the occupancy rate interval A Is 2; occupancy rate Interval B Is { (CPU occupancy 30%, CPU occupancy 40%](memory occupancy rate is 60%, memory occupancy rate is 70%)]The load ratio Index corresponding to the occupancy rate interval B Is 1.5. The occupancy Interval corresponding to the resource occupancy can be determined as Interval B Then, interval is divided B Corresponding load ratio Index B Performing multiplication operation with the current threshold index, and using the result of the multiplication operation as a new threshold index, i.e. a new oneThe threshold index is 100mb × 1.5=150mb.
As can be seen from the embodiment shown in fig. 3, in the embodiment of the present invention, at least one occupancy interval is determined, each occupancy interval corresponds to a load proportion, an occupancy interval corresponding to resource occupancy is searched for, a product operation is performed on the load proportion corresponding to the occupancy interval and a threshold indicator, and a result of the product operation is determined as a new threshold indicator.
Fig. 4 is a flowchart of an implementation of creating a buffer queue according to an embodiment of the present invention, and as shown in fig. 4, the method may include the following steps:
in S401, the file name of the selected training picture is acquired, and a file name list is established based on the file name.
Compared with the preset buffer queue with fixed capacity, in the embodiment of the invention, the buffer queue can be also set according to the training pictures of each batch. Specifically, the file name of the training picture selected by the current batch is obtained, and a file name list (list) is created based on the file name.
In S402, the buffer queue is created based on the file name list.
After the file name list corresponding to the current batch is created, a buffer queue is created based on the file name list, specifically, the buffer queue can be created through a creating function in a TensorFlow deep learning framework, in the creating process, the file name list is added as a calling parameter of the creating function, and the creating function is a train _ input _ producer function. After the creation of the buffer queue is completed, the capacity of the buffer queue is the same as the number of pictures of the current batch.
As can be seen from the embodiment shown in fig. 4, in the embodiment of the present invention, the file name of the selected training picture is obtained, the file name list is created based on the file name, and the buffer queue is created based on the file name list.
Fig. 5 is a flowchart of another implementation of creating a buffer queue according to an embodiment of the present invention, and as shown in fig. 5, the method may include the following steps:
in S501, the selected path of the training picture is acquired, and the path of the training picture is converted into a path tensor.
In addition to establishing a file name list, in the embodiment of the present invention, a path of a training picture selected in a current batch may be obtained, and the path of the training picture is converted into tensor data.
In S502, the buffer queue is created based on the path tensor.
Creating a buffer queue based on the path tensor obtained in step S501, and specifically adding the path tensor as a calling parameter of the created function, so that the capacity of the created buffer queue is the same as the number of the added path tensors.
As can be seen from the embodiment shown in fig. 5, in the embodiment of the present invention, the selected path of the training picture is obtained, the path of the training picture is converted into the path tensor, and the buffer queue is created based on the path tensor.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
Corresponding to the deep learning based picture input method described in the foregoing embodiment, fig. 6 shows a block diagram of a deep learning based picture input device provided by an embodiment of the present invention, and referring to fig. 6, the picture input device includes:
the obtaining unit 61 is configured to obtain a preset threshold index, where the threshold index is an index that the deep learning network can support input pictures in a batch of training;
a selecting unit 62, configured to repeatedly select a training picture under a candidate path until the selected training picture reaches the threshold indicator, where candidate pictures are stored under the candidate path;
a creating unit 63, configured to create a buffer queue, and add the selected training picture to the buffer queue;
the decoding unit 64 is configured to create a queue reading object, read the training pictures in the buffer queue through the queue reading object, and decode the read training pictures to obtain training tensor data, where each training tensor data corresponds to one training picture;
an adding unit 65, configured to create a thread manager object, and add all the training tensor data to a call queue through the thread manager object, where the training tensor data in the call queue is used for being called by the deep learning network.
Optionally, the adding unit 65 further includes:
an occupancy rate obtaining unit, configured to obtain a resource occupancy rate of device resources when the deep learning network invokes the training tensor data;
and the adjusting unit is used for adjusting the threshold index according to the resource occupancy rate.
Optionally, the adjusting unit comprises:
determining at least one occupancy rate interval, wherein each occupancy rate interval corresponds to a load proportion;
and searching a target occupancy rate interval which is consistent with the resource occupancy rate in the at least one occupancy rate interval, performing product operation on the load proportion corresponding to the target occupancy rate interval and the threshold index, and determining the result of the product operation as a new threshold index.
Optionally, the creating unit 63 includes:
acquiring the file name of the selected training picture, and establishing a file name list based on the file name;
creating the buffer queue based on the list of file names.
Optionally, the creating unit 63 includes:
acquiring a selected path of the training picture, and converting the path of the training picture into a path tensor;
creating the buffer queue based on the path tensor.
Optionally, the selected cell 62 further comprises:
and the retrieval unit is used for retrieving all pictures which accord with a preset picture format and determining the path of the retrieved pictures as the candidate path.
Therefore, the image input device based on deep learning provided by the embodiment of the invention can be used for inputting images based on modes of batch and double queues, so that the stability of image input and image training is improved, and the risk of memory collapse is reduced.
Fig. 7 is a schematic diagram of a terminal device according to an embodiment of the present invention. As shown in fig. 7, the terminal device 7 of this embodiment includes: a processor 70, a memory 71 and a computer program 72, such as a deep learning based picture input program, stored in said memory 71 and executable on said processor 70. The processor 70, when executing the computer program 72, implements the steps in each of the above-described embodiments of the deep learning based picture input method, such as the steps S101 to S105 shown in fig. 1. Alternatively, the processor 70, when executing the computer program 72, implements the functions of the units in each of the above-described embodiments of the deep learning based picture input device, such as the functions of the units 61 to 65 shown in fig. 6.
Illustratively, the computer program 72 may be divided into one or more units, which are stored in the memory 71 and executed by the processor 70 to accomplish the present invention. The one or more units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution process of the computer program 72 in the terminal device 7. For example, the computer program 72 may be divided into an acquisition unit, a selection unit, a creation unit, a decoding unit, and an addition unit, and each unit functions as follows:
the acquisition unit is used for acquiring a preset threshold index, wherein the threshold index is an index of a deep learning network which can support input pictures in a batch of training;
the selecting unit is used for repeatedly selecting the training pictures under the candidate paths until the selected training pictures reach the threshold index, wherein the candidate paths store the candidate pictures;
the creating unit is used for creating a buffer queue and adding the selected training picture to the buffer queue;
the decoding unit is used for creating a queue reading object, reading the training pictures in the buffer queue through the queue reading object, and decoding the read training pictures to obtain training tensor data, wherein each training tensor data corresponds to one training picture;
and the adding unit is used for creating a thread manager object and adding all the training tensor data to a calling queue through the thread manager object, wherein the training tensor data in the calling queue are used for being called by the deep learning network.
The terminal device 7 may be a desktop computer, a notebook, a palm computer, a cloud server, or other computing devices. The terminal device may include, but is not limited to, a processor 70, a memory 71. It will be appreciated by those skilled in the art that fig. 7 is merely an example of a terminal device 7 and does not constitute a limitation of the terminal device 7 and may comprise more or less components than shown, or some components may be combined, or different components, for example the terminal device may further comprise input output devices, network access devices, buses, etc.
The Processor 70 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The storage 71 may be an internal storage unit of the terminal device 7, such as a hard disk or a memory of the terminal device 7. The memory 71 may also be an external storage device of the terminal device 7, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the terminal device 7. Further, the memory 71 may also include both an internal storage unit and an external storage device of the terminal device 7. The memory 71 is used for storing the computer programs and other programs and data required by the terminal device. The memory 71 may also be used to temporarily store data that has been output or is to be output.
It is obvious to those skilled in the art that, for convenience and simplicity of description, the above division of each functional unit is only used for illustration, and in practical applications, the above function distribution may be performed by different functional units according to needs, that is, the internal structure of the terminal device is divided into different functional units to perform all or part of the above described functions. Each functional unit in the embodiments may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units are only used for distinguishing one functional unit from another, and are not used for limiting the protection scope of the application. The specific working process of the units in the system may refer to the corresponding process in the foregoing method embodiment, and is not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the embodiments provided in the present invention, it should be understood that the disclosed terminal device and method may be implemented in other ways. For example, the above-described terminal device embodiments are merely illustrative, and for example, the division of the units is only one logical function division, and there may be other divisions when actually implementing, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not implemented. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one position, or may be distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow of the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method embodiments may be implemented. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, read-Only Memory (ROM), random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer-readable medium may contain suitable additions or subtractions depending on the requirements of legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer-readable media may not include electrical carrier signals or telecommunication signals in accordance with legislation and patent practice.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present invention, and are intended to be included within the scope of the present invention.

Claims (7)

1. A picture input method based on deep learning is characterized by comprising the following steps:
acquiring a preset threshold index, wherein the threshold index is an index of a deep learning network capable of supporting input pictures in a batch of training;
repeatedly selecting a training picture under a candidate path until the selected training picture reaches the threshold index, wherein candidate pictures are stored under the candidate path;
creating a buffer queue, and adding the selected training picture to the buffer queue;
creating a queue reading object, reading the training pictures in the buffer queue through the queue reading object, and decoding the read training pictures to obtain training tensor data, wherein each training tensor data corresponds to one training picture;
creating a thread manager object and adding all the training tensor data to a calling queue through the thread manager object, wherein the training tensor data in the calling queue are used for being called by the deep learning network;
acquiring the resource occupancy rate of equipment resources when the deep learning network calls the training tensor data;
determining at least one occupancy rate interval, wherein each occupancy rate interval corresponds to a load proportion; and searching a target occupancy rate interval which is consistent with the resource occupancy rate in the at least one occupancy rate interval, multiplying the load proportion corresponding to the target occupancy rate interval by the threshold index, and determining the result of the multiplication as a new threshold index.
2. The picture input method of claim 1, wherein the creating a buffer queue comprises:
acquiring the file name of the selected training picture, and establishing a file name list based on the file name;
creating the buffer queue based on the list of file names.
3. The picture input method of claim 1, wherein the creating a buffer queue comprises:
acquiring a selected path of the training picture, and converting the path of the training picture into a path tensor;
creating the buffer queue based on the path tensor.
4. The picture input method of claim 1, wherein the repeating, before selecting the training picture under the candidate path, further comprises:
and retrieving all pictures which accord with a preset picture format, and determining the path of the retrieved pictures as the candidate path.
5. A picture input device based on deep learning, comprising:
the acquisition unit is used for acquiring a preset threshold index, wherein the threshold index is an index of a deep learning network which can support input pictures in a batch of training;
the selecting unit is used for repeatedly selecting the training pictures under the candidate paths until the selected training pictures reach the threshold index, wherein the candidate paths store the candidate pictures;
the creating unit is used for creating a buffer queue and adding the selected training pictures to the buffer queue;
the decoding unit is used for creating a queue reading object, reading the training pictures in the buffer queue through the queue reading object, and decoding the read training pictures to obtain training tensor data, wherein each training tensor data corresponds to one training picture;
an adding unit, configured to create a thread manager object, and add all the training tensor data to a call queue through the thread manager object, where the training tensor data in the call queue is used for being called by the deep learning network;
an occupancy rate obtaining unit, configured to obtain a resource occupancy rate of the device resource when the deep learning network invokes the training tensor data;
an adjusting unit, configured to adjust the threshold indicator according to the resource occupancy, including: determining at least one occupancy rate interval, wherein each occupancy rate interval corresponds to a load proportion; and searching a target occupancy rate interval which is consistent with the resource occupancy rate in the at least one occupancy rate interval, performing product operation on the load proportion corresponding to the target occupancy rate interval and the threshold index, and determining the result of the product operation as a new threshold index.
6. A terminal device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, the processor implementing the following steps when executing the computer program:
acquiring a preset threshold index, wherein the threshold index is an index of a deep learning network capable of supporting input pictures in a batch of training;
repeatedly selecting a training picture under a candidate path until the selected training picture reaches the threshold index, wherein candidate pictures are stored under the candidate path;
creating a buffer queue, and adding the selected training picture to the buffer queue;
creating a queue reading object, reading the training pictures in the buffer queue through the queue reading object, and decoding the read training pictures to obtain training tensor data, wherein each training tensor data corresponds to one training picture;
creating a thread manager object, and adding all the training tensor data to a call queue through the thread manager object, wherein the training tensor data in the call queue are used for being called by the deep learning network;
acquiring the resource occupancy rate of the equipment resources when the deep learning network calls the training tensor data;
determining at least one occupancy rate interval, wherein each occupancy rate interval corresponds to a load proportion; and searching a target occupancy rate interval which is consistent with the resource occupancy rate in the at least one occupancy rate interval, multiplying the load proportion corresponding to the target occupancy rate interval by the threshold index, and determining the result of the multiplication as a new threshold index.
7. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the picture input method according to any one of claims 1 to 4.
CN201910500560.6A 2019-06-11 2019-06-11 Image input method and device based on deep learning and terminal equipment Active CN110378479B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910500560.6A CN110378479B (en) 2019-06-11 2019-06-11 Image input method and device based on deep learning and terminal equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910500560.6A CN110378479B (en) 2019-06-11 2019-06-11 Image input method and device based on deep learning and terminal equipment

Publications (2)

Publication Number Publication Date
CN110378479A CN110378479A (en) 2019-10-25
CN110378479B true CN110378479B (en) 2023-04-14

Family

ID=68250087

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910500560.6A Active CN110378479B (en) 2019-06-11 2019-06-11 Image input method and device based on deep learning and terminal equipment

Country Status (1)

Country Link
CN (1) CN110378479B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112085166A (en) * 2020-09-10 2020-12-15 江苏提米智能科技有限公司 Convolutional neural network model accelerated training method and device, electronic equipment and storage medium
CN114237918B (en) 2022-02-28 2022-05-27 之江实验室 Graph execution method and device for neural network model calculation

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108182469A (en) * 2017-12-27 2018-06-19 郑州云海信息技术有限公司 A kind of neural network model training method, system, device and storage medium
CN108711138A (en) * 2018-06-06 2018-10-26 北京印刷学院 A kind of gray scale picture colorization method based on generation confrontation network
CN108885571A (en) * 2016-04-05 2018-11-23 谷歌有限责任公司 The input of batch machines learning model
US10210860B1 (en) * 2018-07-27 2019-02-19 Deepgram, Inc. Augmented generalized deep learning with special vocabulary

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108885571A (en) * 2016-04-05 2018-11-23 谷歌有限责任公司 The input of batch machines learning model
CN108182469A (en) * 2017-12-27 2018-06-19 郑州云海信息技术有限公司 A kind of neural network model training method, system, device and storage medium
CN108711138A (en) * 2018-06-06 2018-10-26 北京印刷学院 A kind of gray scale picture colorization method based on generation confrontation network
US10210860B1 (en) * 2018-07-27 2019-02-19 Deepgram, Inc. Augmented generalized deep learning with special vocabulary

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
tensorflow中协调器tf.train.Coordinator和入队线程启动器tf.train.start_queue_runners;-牧野-;《CSDN博客-https://blog.csdn.net/dcrmg/article/details/79780331》;20180401;第1-4页 *
TensorFlow入门13——图片文件读取;一个人的游弋;《知乎-https://zhuanlan.zhihu.com/p/53630398/》;20181229;第1-2页 *
怎么选取训练神经网络时的Batch size?;Jiecheng Zhao;《知乎-https://www.zhihu.com/question/61607442/answer/204586969》;20170728;第1-3页 *
经典网络复现系列(二):SegNet;月半rai;《CSDN博客-https://blog.csdn.net/zlrai5895/article/details/80579094》;20180605;第1-9页 *

Also Published As

Publication number Publication date
CN110378479A (en) 2019-10-25

Similar Documents

Publication Publication Date Title
CN108228463B (en) Method and device for detecting first screen time
CN110378479B (en) Image input method and device based on deep learning and terminal equipment
CN110826685A (en) Method and device for convolution calculation of neural network
CN112181657A (en) Video processing method and device, electronic equipment and storage medium
CN112287257A (en) Page display method and device, electronic equipment and storage medium
CN111814820A (en) Image processing method and device
CN105488470A (en) Method and apparatus for determining character attribute information
CN114741389A (en) Model parameter adjusting method and device, electronic equipment and storage medium
WO2021073638A1 (en) Method and apparatus for running neural network model, and computer device
CN110349076B (en) Data processing method and device
CN116912556A (en) Picture classification method and device, electronic equipment and storage medium
CN115797267A (en) Image quality evaluation method, system, electronic device, and storage medium
CN113746484B (en) Data compression and decompression method, device, equipment and medium
CN114218175A (en) Resource cross-platform sharing method and device, terminal equipment and storage medium
CN115878949A (en) Signal processing method and related equipment
CN111339367B (en) Video processing method and device, electronic equipment and computer readable storage medium
US20170235356A1 (en) Electronic device and method of reducing power thereof
CN111597476A (en) Image processing method and device
CN112331310A (en) Medical image data display method and device, storage medium and intelligent equipment
CN111862894A (en) Backlight brightness adjusting method, device, terminal and readable storage medium
CN113992618B (en) Super-resolution image processing method, system, electronic device and storage medium
CN110782389A (en) Image data byte alignment method and terminal
CN111259177B (en) Black-white binary signature picture storage method and system
CN111460269B (en) Information pushing method and device
CN113569092B (en) Video classification method and device, electronic equipment and storage 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