Disclosure of Invention
The invention aims to provide a specimen conveying congestion detection system based on image recognition and counting, aiming at the defects in the prior art.
In order to achieve the above object, the present invention provides a specimen transport congestion detection system based on image recognition and counting, comprising a main control computer, the main control computer is connected with a first collecting terminal and a second collecting terminal, the first collecting terminal and the second collecting terminal are respectively arranged at an inlet side and an outlet side of a transport device, the main control computer controls the first collecting terminal and the second collecting terminal to collect image data at the inlet side and the outlet side of the transport device at set time intervals, the main control computer is connected with a server to transmit the image data at the inlet side and the outlet side of the transport device to the server, the server recognizes the number of specimens currently put into the transport device based on the image data collected by the first collecting terminal, and recognizes the number of specimens currently sent out by the transport device based on the image data collected by the second collecting terminal, the server performs specimen putting accumulation counting according to the number of specimens currently put into the transport device, and starting timing after each time of accumulated counting is finished, wherein the server carries out the sample sending accumulated counting according to the number of the samples sent by the conveying device at present, and if the total number of the sent samples is different from the total number of the put samples when the timing is started when the timing reaches the set time, the server outputs an alarm signal.
Further, the specimen comprises a blood collection vacuum tube, and the server identifies a tube cap of the blood collection vacuum tube based on a mobilent-ssd algorithm and counts based on the identified tube cap.
Furthermore, the server demarcates an identification area for the image data acquired by the first acquisition terminal and the second acquisition terminal, and calculates the time t required for the pipe cap to pass through the identification area:
t=S/v
wherein S is the length of the identification area in the moving direction of the conveying device, and v is the conveying speed of the conveying device;
the acquisition frequencies of the first acquisition terminal and the second acquisition terminal are set according to time t, so that the first acquisition terminal and the second acquisition terminal can acquire image data in a multi-frame identification area within the time t, and when the server identifies that the number of frames of the image data with the blood sampling vacuum tube in the identification area is more than a set proportion, the server judges that the current blood sampling vacuum tube passes through;
the server extracts image data with the blood sampling vacuum tube in the identification area and respectively acquires plane coordinates of the central point of the tube cap in the identification area, and the server calculates the transverse displacement X and the longitudinal displacement Y of the tube cap according to the plane coordinates of the central point of the tube cap in the two adjacent frames of image data with the blood sampling vacuum tube:
X=xn-xn+1
Y=yn-yn+1
wherein x isn,ynIs the coordinate value, x, of the center point of the cap in the identification region of the nth frame image datan+1,yn+1The coordinate value of the central point of the pipe cap of the (n + 1) th frame of image data in the identification area is shown, and n is a natural number greater than 0;
if X is less than delta X and Y is less than delta Y, the server judges that the blood sampling vacuum tubes in the two frames of image data are the same, otherwise, the blood sampling vacuum tubes are different, wherein delta X is the maximum transverse displacement between the two frames in the set identification area, and delta Y is the maximum longitudinal displacement between the two frames in the set identification area.
Further, the main control machine comprises a first main control machine and a second main control machine, the first main control machine is connected with the first acquisition terminal, and the second main control machine is connected with the second acquisition terminal.
Further, the server is connected with a display, and the display is used for displaying the total number of the samples to be put in, the total number of the samples to be sent out and congestion events.
Furthermore, the GPIO interface of the industrial personal computer is connected with a control relay, and the control relay is connected with a control circuit of the transmission device so as to control the transmission device to stop according to the alarm signal output by the server.
Furthermore, the control relay is also connected with an audible and visual alarm.
Further, the main control computer comprises a raspberry host and a banana host.
Further, the conveying device comprises a plurality of belt conveying devices.
Has the advantages that: the invention sets the first collecting terminal and the second collecting terminal at the inlet side and the outlet side of the conveying device to collect the image data at the inlet side and the outlet side of the conveying device, identifies the number of the samples placed in the inlet side and the outlet side of the conveying device based on an image identification technology, detects whether the samples are jammed on the conveying device by respectively counting and comparing the number of the placed samples and the number of the sent samples, can be used for conveying and detecting the blood sampling vacuum tubes, identifies by marking an identification area, shoots multi-frame image data when the vacuum blood sampling tubes pass through the identification area, and judges whether the blood sampling vacuum tubes are the same blood sampling vacuum tube or not by the displacement of the tube cap, thereby avoiding repeated counting, and greatly improving the counting precision of the blood sampling vacuum tubes and the precision of jam detection.
Detailed Description
The present invention will be further illustrated with reference to the accompanying drawings and specific examples, which are carried out on the premise of the technical solution of the present invention, and it should be understood that these examples are only for illustrating the present invention and are not intended to limit the scope of the present invention.
As shown in fig. 1 and 2, an embodiment of the present invention provides a specimen transportation congestion detection system based on image recognition and counting, which includes a main control computer, where the main control computer preferably adopts a raspberry host and a banana host. The main control machine is connected with a first acquisition terminal 1 and a second acquisition terminal 2, and specifically, the main control machine and the first acquisition terminal 1 and the second acquisition terminal 2 can be connected through a USB interface or a CSI interface. The first collecting terminal 1 is provided at an inlet side of the conveyor 4 to collect image data at the inlet side of the conveyor 4, and the second collecting terminal 2 is provided at an outlet side of the conveyor 4 to collect image data at the outlet side of the conveyor 4. The first acquisition terminal 1 and the second acquisition terminal 2 acquire image data, and the main control computer controls acquisition at set time intervals, specifically, the duration of the set time intervals can be related to the transmission speed of the transmission device 4 and the coverage area of the acquired image data, and the coverage area of the image data can be just continuous to be the best in the setting mode, so that the phenomenon that the acquired areas are overlapped or have area intervals to cause inaccurate detection is avoided. In order to ensure detection accuracy, the camera pixels of the first capture terminal 1 and the second capture terminal 2 are preferably 500 ten thousand or more. The main control computer is connected with a server 5, the main control computer sends image data of an inlet side and an outlet side of a conveying device 4 acquired by a first acquisition terminal 1 and a second acquisition terminal 2 respectively to the server 5, the server 5 identifies the number of specimens 6 currently put into the conveying device 4 based on the image data acquired by the first acquisition terminal 1, and identifies the number of the specimens 6 currently sent out by the conveying device 4 based on the image data acquired by the second acquisition terminal 2, particularly, the server 5 identifies the number of the specimens 6 in the image data and completes the identification based on an image identification technology. The server 5 carries out the sample input accumulation counting according to the number of the samples 6 currently put into the conveying device 4, the server 5 starts timing after the accumulation counting is finished each time, the server 5 carries out the sample output accumulation counting according to the number of the samples currently sent out by the conveying device, and if the total number of the samples 6 sent out is different from the total number of the samples 6 put in when the timing is started when the timing reaches the set time, the server 5 outputs an alarm signal.
The set time is longer than the time from the time when the specimen 6 is placed in the transfer device 4 to the time when the specimen 6 is sent out from the transfer device 4, and if the time from the time when the specimen 6 is placed in the transfer device 4 to the time when the specimen 6 is sent out from the transfer device 4 is 2 minutes, the set time needs to be set to 2 minutes or longer, for example, 2.5 minutes.
For example, 70 samples 6 are already put in a certain time, three times of samples 6 are put in the subsequent time, the server 5 detects that 2 samples 6 are put in for the first time, the total number of the samples put in is 72 by carrying out the first accumulation counting, and then the first putting timing is started; the server 5 detects that 1 sample 6 is put in for the second time, carries out the second accumulation counting to obtain that the total number of the sample 6 put in is 73, and then starts the second time putting timing; the server 5 detects that 2 samples 6 are put into the server for the third time, performs the third cumulative counting to obtain that the total number of the samples 6 is 75, and then starts the third time putting timing. If the specimen 6 is not jammed on the conveying device 4, the server 5 can detect that the specimen 6 is respectively sent out from the conveying device 4 through the image data acquired by the second acquisition terminal 2 before the three times of timing respectively reach the set time, and if the specimen 6 put in at a certain time is jammed on the conveying device 4, the server 6 can compare the total number of sent out specimens 6 with the total number of put in specimens 6 at the beginning of timing to detect that the specimen 6 is jammed, and then the attendant is reminded through an alarm signal to avoid further serious consequences.
The specimen 6 of the present embodiment includes a blood collection vacuum tube. Because the tube body of the blood sampling vacuum tube is made of transparent materials, when the server 5 identifies the image data, whether the image data has the blood sampling vacuum tubes and the number of the blood sampling vacuum tubes or not can be judged through the tube caps of the blood sampling vacuum tubes. The server 5 may identify the cap 9 of the blood collection vacuum tube based on the mobilent-ssd algorithm and count based on the identified cap 9. By training and optimizing the mobilent-ssd, all the tube caps 9 of the blood sampling vacuum tubes in one picture can be identified, and the identification accuracy can reach more than 99%. The existing conveying device 4 for conveying blood sampling vacuum tubes generally adopts a plurality of belt conveying devices, the belt conveying devices are arranged in close proximity according to the transmission distance and the position, and the conveying between different floors can be realized, and the improvement of the conveying device 4 is not related, so that the description is omitted. It should be noted that the first collecting terminal 1 and the second collecting terminal 2 may also be disposed at the inlet side and the outlet side of each belt conveyor, so as to divide the whole conveyor 4 into a plurality of areas for detection, and avoid that the jam event and the jam position cannot be found at the first time when the distance of the whole conveyor 4 is too long and the conveying time is long.
In order to improve the accuracy of vacuum blood collection tube counting, the server 5 defines an identification area 10 for the image data collected by the first collection terminal 1 and the second collection terminal 2, and calculates the time t required for the tube cap 9 to pass through the identification area 10:
t=S/v
wherein S is the length of the identification area 10 in the direction of movement of the conveyor, and v is the transport speed of the conveyor 4;
the acquisition frequencies of the first acquisition terminal 1 and the second acquisition terminal 2 are set according to time t, so that the first acquisition terminal 1 and the second acquisition terminal 2 can acquire image data in a multi-frame identification region 10 within the time t, and when the server 5 identifies that the number of frames of the image data with the blood sampling vacuum tube in the identification region 10 is more than a set proportion, the server judges that the current blood sampling vacuum tube passes through; the image data in the identification area 10 acquired by the first acquisition terminal 1 and the second acquisition terminal 2 within the time t is preferably 3 or 5 frames, the set proportion is preferably fifty percent, taking the acquisition of three frames as an example, the server 5 can identify a blood sampling vacuum tube from two frames of image data, that is, the current blood sampling vacuum tube passes through, if the blood sampling vacuum tube can be identified from only one frame of image data, the false identification is ignored, so that the accuracy of vacuum blood sampling tube identification can be greatly improved.
Because the image data that first collection terminal 1 and second collection terminal 2 were shot are multiframe, the vacuum test tube can appear in the identification area 10 of multiframe image data, and at this moment, if count according to the number of the vacuum test tube of discerning obviously is inaccurate, still need avoid repeated count. The repeated counting avoidance is realized by the following method, the server 5 extracts the image data with the blood sampling vacuum tube in the identification area 10 and respectively obtains the plane coordinates of the central point of the tube cap 9 in the identification area 10, and the server 5 calculates the transverse displacement X and the longitudinal displacement Y of the tube cap 9 according to the plane coordinates of the central point of the tube cap 9 in the adjacent two frames of image data with the blood sampling vacuum tube:
X=xn-xn+1
Y=yn-yn+1
wherein x isn,ynThe coordinate value, x, of the center point of the cap 9 in the identification area 10 for the nth frame image datan+1,yn+1The coordinate value of the central point of the pipe cap 9 of the (n + 1) th frame of image data in the identification area 10, wherein n is a natural number more than 0;
if X is less than delta X and Y is less than delta Y, the server judges that the blood sampling vacuum tubes in the two frames of image data are the same, otherwise, the blood sampling vacuum tubes are different, wherein delta X is the maximum transverse displacement between the two frames in the set identification area 10, and delta Y is the maximum longitudinal displacement between the two frames in the set identification area 10.
Assuming that the cap 9 appears in three frames of image data when one blood collection vacuum tube passes through the identification area 10, that is, the first collection terminal 1 or the second collection terminal 2 captures three times, first, as shown in fig. 3, the coordinate of the center point of the cap 9 in the identification area 10 in the first frame of image data is (x) in the first frame of image data1,y1) As shown in FIG. 4, the center point of the cap 9 in the second frame image data is (x) at the coordinate of the identification area 102,y2) Finally, as shown in fig. 5, the coordinates of the center point of the cap 9 in the identification area 10 in the third frame image data are (x3, y 3). Then, according to the coordinates of the central point of the cap 9 in the first frame image data and the second frame image data, the transverse displacement X and the longitudinal displacement Y are calculated, when X is X1-X2<δx,Y=y1-y2<δ y, the tube cap 9 appearing in the first frame of image data and the second frame of image data can be judged to belong to the same blood sampling vacuum tube. When X is X2-X3<δx,Y=y2-y3<δ y, the pipe cap 9 in the second frame of image data and the pipe cap 9 in the third frame of image data can be judged to belong to the same blood sampling vacuum pipe again, and the counting is carried out once. Otherwise, judging the blood sampling vacuum tube to belong to different blood sampling vacuum tubes and counting.
It should be noted that the value of δ x is related to the number of frames of the image data in the identification area 10 acquired by the first acquisition terminal 1 and the second acquisition terminal 2 within the time t, taking 3 frames as an example, since the server 5 determines that the vacuum blood collection tube passes through the tube cap 9 when identifying the tube cap 9 from the image data of more than two frames, when the first frame image data and the third frame image data identify the tube cap 9, the displacement of the tube cap 9 in the first frame image data and the third frame image data is the theoretical maximum displacement (two thirds of the length of the identification area 10 along the transmission direction), and similarly, when acquiring 5 frames of image data, the theoretical maximum displacement is three fifths of the length of the identification area 10 along the transmission direction, and the value of δ x is preferably the theoretical maximum displacement. The value of delta y is a constant which can be set according to actual needs, and is preferably set to be one half of the length of the blood sampling vacuum tube.
The main control machine may be one, and the distance between the first collection terminal 1 and the second collection terminal 2 is relatively long due to the fact that the transmission distance of the general specimen 6 is relatively long, so as to facilitate connection of the first collection terminal 1 and the second collection terminal 2 with the main control machine, the main control machine of the embodiment of the present invention preferably includes a first main control machine 31 and a second main control machine 32, the first main control machine 31 may be disposed at one side of the first collection terminal 1 and connected with the first collection terminal 1, and the second main control machine 32 may be disposed at one side of the second collection terminal 2 and connected with the second collection terminal 2.
In order to facilitate the operators on duty to clearly understand the number of the currently transmitted samples 6 and the working state, the server 5 of the embodiment of the present invention is further connected to a display 7, referring to fig. 2, the display 7 is used for displaying the total number of sample input, the total number of sample output, and congestion events, including the congestion time and the number.
In order to interlockingly control the transmission device 4 to stop when the congestion of the specimen 6 on the transmission device 4 is detected, the industrial personal computer is connected with a control relay 8 through a GPIO interface, when the industrial personal computer receives an alarm signal output by the server 5, the industrial personal computer controls the control relay 8 to be powered on, a normally open contact of the control relay 8 is connected with a control circuit of the transmission device 4, and the driving motor of the transmission device 4 is controlled to stop according to the alarm signal output by the server, so that the serious consequence caused by the further congestion of the specimen 6 due to the continuous operation of the transmission device 4 is avoided. In order to further facilitate reminding of the person on duty, the control relay 8 can be connected with the audible and visual alarm, specifically, the normally open contact of the control relay 8 is connected with the audible and visual alarm and the power supply, and when the control relay 8 is electrified and attracted, the normally open contact of the control relay 8 connects the audible and visual alarm with the power supply, so that the audible and visual alarm sends an audible and visual alarm signal.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that other parts not specifically described are within the prior art or common general knowledge to those of ordinary skill in the art. Without departing from the principle of the invention, several improvements and modifications can be made, and these improvements and modifications should also be construed as the scope of the invention.