CN109657601B - Target team length statistical method based on target detection algorithm and clustering algorithm - Google Patents

Target team length statistical method based on target detection algorithm and clustering algorithm Download PDF

Info

Publication number
CN109657601B
CN109657601B CN201811536930.3A CN201811536930A CN109657601B CN 109657601 B CN109657601 B CN 109657601B CN 201811536930 A CN201811536930 A CN 201811536930A CN 109657601 B CN109657601 B CN 109657601B
Authority
CN
China
Prior art keywords
target
clustering
team
algorithm
point
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
CN201811536930.3A
Other languages
Chinese (zh)
Other versions
CN109657601A (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.)
Chinaccs Information Industry Co ltd
Original Assignee
Chinaccs Information Industry 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 Chinaccs Information Industry Co ltd filed Critical Chinaccs Information Industry Co ltd
Priority to CN201811536930.3A priority Critical patent/CN109657601B/en
Publication of CN109657601A publication Critical patent/CN109657601A/en
Application granted granted Critical
Publication of CN109657601B publication Critical patent/CN109657601B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/50Context or environment of the image
    • G06V20/52Surveillance or monitoring of activities, e.g. for recognising suspicious objects
    • G06V20/53Recognition of crowd images, e.g. recognition of crowd congestion
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/23Clustering techniques
    • G06F18/232Non-hierarchical techniques
    • G06F18/2321Non-hierarchical techniques using statistics or function optimisation, e.g. modelling of probability density functions
    • G06F18/23213Non-hierarchical techniques using statistics or function optimisation, e.g. modelling of probability density functions with fixed number of clusters, e.g. K-means clustering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • G06F18/2413Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches based on distances to training or reference patterns
    • G06F18/24133Distances to prototypes
    • G06F18/24137Distances to cluster centroïds
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V2201/00Indexing scheme relating to image or video recognition or understanding
    • G06V2201/07Target detection
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02TCLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO TRANSPORTATION
    • Y02T10/00Road transport of goods or passengers
    • Y02T10/10Internal combustion engine [ICE] based vehicles
    • Y02T10/40Engine management systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • General Engineering & Computer Science (AREA)
  • Probability & Statistics with Applications (AREA)
  • Multimedia (AREA)
  • Image Analysis (AREA)

Abstract

The invention discloses a target team length statistical method based on a target detection algorithm and a clustering algorithm, which relates to the technical field of computer vision target detection, and the technical scheme comprises S1, target detection; detecting targets appearing in the detection materials in real time through a target detection algorithm to obtain specific position coordinates and belonging categories of the targets; s2, carrying out clustering statistics on the positions of target teams; and obtaining the positions of the target forming teams through a clustering method, and counting the length of the teams. The beneficial effects of the invention are as follows: automatically detecting the position of the target, and automatically searching the position of the target team to obtain the number of targets in each team. The forefront deep learning technology is combined, and the target can be detected rapidly and accurately. Based on KMeans algorithm, a line clustering algorithm is initiated to realize automatic clustering of target teams.

Description

Target team length statistical method based on target detection algorithm and clustering algorithm
Technical Field
The invention relates to the technical field of computer vision target detection, in particular to a target team length statistical method based on a target detection algorithm and a clustering algorithm.
Background
The automatic detection and statistics of the number of targets belongs to the field of computer vision reasoning subdivision, and a great deal of potential demands exist in public places sensitive to crowd concentration such as stations, squares and canteens, or animal group socialization behavior researches such as migratory birds, fish swarm tour and ant colony foraging.
From the technical point of view analysis, the statistics of the number of targets first requires a fast and accurate target detection algorithm. Along with the rapid progress of the deep learning technology in recent years, the open source algorithms of YOLO (you only look once), SSD (Single Shot MultiBox Detector) and the like still can achieve higher detection accuracy on the basis of meeting the real-time video detection, and the technical problem of target detection required by the problem of target quantity statistics is solved well.
Secondly, how to calculate the number of objects that fit a certain geometrical distribution from the detected objects is another technical challenge. For example, in ticket halls, canteens, etc., people are easily gathered, and the people are generally distributed in the form of teams, how to obtain the location of teams and count the number of people is a key problem.
Disclosure of Invention
In order to achieve the above object, the present invention provides a target team length statistical method based on a target detection algorithm and a clustering algorithm.
The technical proposal is that the method adopts a target detection algorithm based on deep learning to detect the position coordinates and the category of the target, and is characterized in that,
s1, target detection;
detecting targets appearing in the detection materials in real time through a target detection algorithm to obtain specific position coordinates and belonging categories of the targets;
s2, carrying out clustering statistics on the positions of target teams;
and obtaining the positions of the target forming teams through a clustering method, and counting the length of the teams.
Preferably, in the step S1, the target detection algorithm may be a mainstream algorithm such as YOLO, SSD, and fast R-CNN, where YOLO and SSD may meet the real-time detection requirement, and the fast R-CNN has a slightly slow speed, but high detection accuracy. The embodiment adopts a YOLO algorithm architecture, which comprises dividing grids on an input image, extracting multi-layer features of the image through a multi-layer convolution network (CNN), deducing whether each grid on the original image is associated with a target or not by adopting the highest-layer features, and deducing the accurate position of the target.
Preferably, the target position coordinate is a square frame containing a single target, and because the position square frame does not necessarily contain the lower part of the target in the case that the target is blocked by other objects, the upper middle point of the target square frame is selected as the position coordinate of the target; the object belongs to the category of "person", and since the object does not affect the subsequent clustering algorithm, only the position coordinates are contained in the attribute data of each object.
Preferably, in the step S2, a common clustering algorithm such as KMeans can only cluster the targets to the point center, and the target team studied in the scheme has a geometric distribution form such as a line center and is realized by modifying the KMeans algorithm. The specific algorithm of clustering is as follows:
a1, vectorizing the target position obtained in the step S1, and subtracting any point in the space from the target position coordinate to obtain a vectorized target position;
a2, projecting all target vectors to a unit vector e, wherein e is a perpendicular vector of the searched team position straight line;
a3, carrying out KMeans clustering on the target projection points obtained in the A2 to obtain the class center position of each class and the class to which each target belongs; after the clustering result is obtained, further calculating the sum D of all the target projection points and the center-like distance;
a4, circularly carrying out the steps A2 and A3, searching an optimal direction angle of e, wherein the direction with the minimum D value is the optimal direction of e, traversing all directions of e from 0 degrees to 180 degrees, and returning to the step A2 to obtain the coordinates of the projection point of the target position in each direction; and step A3, obtaining a clustering result and a D value of the direction, namely carrying out KMeans clustering on target points in all directions, selecting a clustering result with the minimum D value as an optimal e, and simultaneously counting the number of targets in each class, namely the length of the target team;
a5, taking the angle +90° or-90 ° of the optimal vector e obtained in the A4 as the direction of the target team linear equation, taking the clustering center as the passing point of the target team, and completely determining the position of the target team by the position of the point and the direction of the target team.
Preferably, in the above-mentioned A1, in a specific operation, all the coordinates of the target position are subtracted from any fixed point C in the space, so as to obtain the target vector σ related to the point C.
Preferably, any fixed point C may select the image center point.
Preferably, in the step A2, the expression of e is:
e=(cos(θ),sin(θ))
wherein θ is a direction angle, and an initial value is set to 0 °; e represents a direction perpendicular to the center line of the target team to be clustered, and the angle range is 0 DEG to 180 DEG; the projection of the target vector sigma on e obtained in the A2 is in the following cosine dot product mode:
d=σ·e
wherein d is the projection length of the target vector sigma on e;
and then obtaining the projection point coordinates (x, y) of the target position:
(x,y)=d×e。
preferably, in the step S1, the detection material is a video or a picture.
The technical scheme provided by the embodiment of the invention has the beneficial effects that: automatically detecting the position of the target, and automatically searching the position of the target team to obtain the number of targets in each team. The forefront deep learning technology is combined, and the target can be detected rapidly and accurately. Based on KMeans algorithm, a line clustering algorithm is initiated to realize automatic clustering of target teams.
Drawings
Fig. 1 is a typical algorithm framework diagram of the object detection algorithm YOLO according to an embodiment of the present invention.
Fig. 2 is a flowchart of an algorithm according to an embodiment of the present invention.
Fig. 3 is a diagram showing the effect of target detection according to an embodiment of the present invention.
FIG. 4 is a schematic diagram of a target team clustering result according to an embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present invention more apparent. Of course, the specific embodiments described herein are for purposes of illustration only and are not intended to limit the invention.
It should be noted that, without conflict, the embodiments of the present invention and features of the embodiments may be combined with each other.
In the description of the invention, it should be understood that the terms "center," "longitudinal," "transverse," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," and the like indicate orientations or positional relationships that are based on the orientation or positional relationships shown in the drawings, merely to facilitate describing the invention and simplify the description, and do not indicate or imply that the device or element being referred to must have a particular orientation, be configured and operate in a particular orientation, and therefore should not be construed as limiting the invention. Furthermore, the terms "first," "second," and the like, are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first", "a second", etc. may explicitly or implicitly include one or more such feature. In the description of the invention, unless otherwise indicated, the meaning of "a plurality" is two or more.
In the description of the invention, it should be noted that, unless explicitly specified and limited otherwise, the terms "mounted," "connected," and "connected" are to be construed broadly, and may be, for example, fixedly connected, detachably connected, or integrally connected; can be mechanically or electrically connected; can be directly connected or indirectly connected through an intermediate medium, and can be communication between two elements. The specific meaning of the above terms in the creation of the present invention can be understood by those of ordinary skill in the art in a specific case.
Example 1
Referring to fig. 1 to 4, the present invention provides a target team length statistics method based on a target detection algorithm and a clustering algorithm, and the operation steps of the present invention are described in detail by taking crowd team length detection in a waiting hall of a station as an example.
And step 1, target detection. And acquiring the position and the category of the target in the image by adopting a deep learning target detection algorithm meeting the detection speed and precision requirements, wherein fig. 3 is a detection demonstration effect diagram.
The object detection returns the position coordinates and the belonging category of each object. The target position coordinates are boxes containing a single target, and because there is a case where the target is blocked by another object, the position boxes cannot necessarily contain the lower part of the target, and therefore the upper middle point of the target box is selected as the position coordinates of the target. The category to which the object as shown in fig. 3 belongs is "person", and since it does not affect the subsequent clustering algorithm, only the position coordinates are included in the attribute data of each object. Typical target attribute data are as in table 1:
Figure SMS_1
TABLE 1 target position coordinates
And 2, vectorizing the target position. The relative vector of the target position and any space reference point is taken as the position vector of each target. Specifically, a center point (128 ) of a video frame (for example, 25x 256 pixels) may be selected as a reference point, and the position coordinates in table 1 are subtracted from the coordinates of the reference point, so as to obtain a position vector of the target, as shown in table 2:
Figure SMS_2
TABLE 2 target position vector coordinates
Step 3, the position vector σ is projected to the unit vector e. The unit vector e is related to the direction of the target team to be determined, an included angle of 90 degrees is formed between the unit vector e and the direction of the target team can be determined by determining the direction of the unit vector e. The definition of the unit vector e is the formula e= (cos (θ), sin (θ)), and the initial direction θ is set to 0 °.
The projected length d of the target position vector σ given in table 2 in the e direction can be obtained by taking the dot product of the target position vector σ and e as shown in formula d=σ·e.
And then obtaining the projection point coordinates (x, y) of the target position:
(x,y)=d×e (3)
the calculation results are shown in table 3, corresponding to the example of table 2:
Figure SMS_3
TABLE 3 coordinates of projected points of target locations
And 4, KMeans clustering. And carrying out classical KMeans clustering on the target position projection points in the table 3 to obtain the class center position of each class and the class to which each target belongs. I.e. different targets identified in tables 4 and 5 respectively as shown in tables 4 and 5:
Figure SMS_4
Figure SMS_5
table 4 class center point coordinates
Figure SMS_6
TABLE 5 class to which the target belongs
After the clustering result is obtained, the sum D of all the target projection points and the center-like distance is further calculated.
And 5, searching an optimal direction angle of e. And (3) enabling the direction with the minimum D value to be the optimal direction of e, specifically, continuously changing the direction angle of e between 0 and 180 degrees, and returning to the step (3) to obtain the target position projection point coordinates of each direction. And then, obtaining a clustering result and a D value of the direction through the step 4, and selecting a clustering result with the minimum D value after traversing all the directions.
And 6, calculating a linear equation of the target team. Subtracting 90 degrees from the optimal direction of e obtained in the step 5 to obtain the direction of a target team linear equation, wherein the corresponding clustering center is a point on a straight line. The linear equation can be determined from a point and direction. The results are shown in FIG. 4.
The foregoing description of the preferred embodiments of the invention is not intended to limit the invention to the precise form disclosed, and any such modifications, equivalents, and alternatives falling within the spirit and scope of the invention are intended to be included within the scope of the invention.

Claims (5)

1. The target team length statistical method based on the target detection algorithm and the clustering algorithm adopts the target detection algorithm based on the deep learning to detect the position coordinates and the belonging categories of the targets, and is characterized in that,
s1, target detection;
detecting targets appearing in the detection materials in real time through a target detection algorithm to obtain specific position coordinates and belonging categories of the targets;
s2, carrying out clustering statistics on the positions of target teams;
obtaining the position of the target team by a clustering method, and counting the length of the team;
in the step S1, the target detection algorithm comprises dividing grids on an input image, extracting multi-layer features of the image through a multi-layer convolution network, deducing whether each grid on an original image is associated with a target or not by adopting the highest-layer features, and deducing the accurate position of the target;
the target position coordinates are boxes containing single targets, and the middle point on the upper edge of each target box is selected as the position coordinates of the target; the attribute data of each object only comprises position coordinates;
in S2, the specific algorithm of clustering is as follows:
a1, vectorizing the target position obtained in the step S1, and subtracting any point in the space from the target position coordinate to obtain a vectorized target position;
a2, projecting all target vectors to a unit vector e, wherein e is a perpendicular vector of the searched team position straight line;
a3, carrying out KMeans clustering on the target projection points obtained in the A2 to obtain the class center position of each class and the class to which each target belongs; after the clustering result is obtained, further calculating the sum D of all the target projection points and the center-like distance;
a4, circularly carrying out the steps A2 and A3, searching an optimal direction angle of e, wherein the direction with the minimum D value is the optimal direction of e, traversing all directions of e from 0 degrees to 180 degrees, and returning to the step A2 to obtain the coordinates of the projection point of the target position in each direction; and step A3, obtaining a clustering result and a D value of the direction, namely carrying out KMeans clustering on target points in all directions, selecting a clustering result with the minimum D value as an optimal e, and simultaneously counting the number of targets in each class, namely the length of the target team;
a5, taking the angle +90° or-90 ° of the optimal vector e obtained in the A4 as the direction of the target team linear equation, taking the clustering center as the passing point of the target team, and completely determining the position of the target team by the position of the point and the direction of the target team.
2. The target team length statistics method based on the target detection algorithm and the clustering algorithm according to claim 1, wherein in the A1, in a specific operation, all target position coordinates are subtracted from any fixed point C in space, so as to obtain a target vector σ related to the point C.
3. The target team length statistics method based on the target detection algorithm and the clustering algorithm according to claim 2, wherein any one fixed point C is selected as an image center point.
4. The target team length statistics method based on the target detection algorithm and the clustering algorithm according to claim 1, wherein in the step A2, the expression of e is:
e=(cos(θ),sin(θ))
wherein θ is a direction angle, and an initial value is set to 0 °; e represents a direction perpendicular to the center line of the target team to be clustered, and the angle range is 0 DEG to 180 DEG; the projection of the target vector sigma on e obtained in the A2 is in the following cosine dot product mode:
d=σ·e
wherein d is the projection length of the target vector sigma on e;
and then obtaining the projection point coordinates (x, y) of the target position:
(x,y)=d×e。
5. the target team length statistics method based on the target detection algorithm and the clustering algorithm according to any one of claims 1 to 4, wherein in S1, the detected material is a video or a picture.
CN201811536930.3A 2018-12-14 2018-12-14 Target team length statistical method based on target detection algorithm and clustering algorithm Active CN109657601B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811536930.3A CN109657601B (en) 2018-12-14 2018-12-14 Target team length statistical method based on target detection algorithm and clustering algorithm

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811536930.3A CN109657601B (en) 2018-12-14 2018-12-14 Target team length statistical method based on target detection algorithm and clustering algorithm

Publications (2)

Publication Number Publication Date
CN109657601A CN109657601A (en) 2019-04-19
CN109657601B true CN109657601B (en) 2023-07-07

Family

ID=66114198

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811536930.3A Active CN109657601B (en) 2018-12-14 2018-12-14 Target team length statistical method based on target detection algorithm and clustering algorithm

Country Status (1)

Country Link
CN (1) CN109657601B (en)

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103903474B (en) * 2014-04-09 2016-03-02 浙江工业大学 A kind of fleet's induced travel method based on K-means cluster
US10997428B2 (en) * 2015-06-01 2021-05-04 Placemeter Inc. Automated detection of building entrances
CN108304798B (en) * 2018-01-30 2020-09-29 北京同方软件有限公司 Street level order event video detection method based on deep learning and motion consistency
CN108846438B (en) * 2018-06-15 2022-05-24 电子科技大学 Team matching method based on real geographic position

Also Published As

Publication number Publication date
CN109657601A (en) 2019-04-19

Similar Documents

Publication Publication Date Title
US10891741B2 (en) Human analytics using fusion of image and depth modalities
Paul et al. FAB-MAP 3D: Topological mapping with spatial and visual appearance
CN110866079B (en) Generation and auxiliary positioning method of intelligent scenic spot live-action semantic map
Boogaard et al. Robust node detection and tracking in fruit-vegetable crops using deep learning and multi-view imaging
CN110533722A (en) A kind of the robot fast relocation method and system of view-based access control model dictionary
CN104899883B (en) A kind of room objects cube body detecting method of depth image scene
KR20180004151A (en) Apparatus and method for real-time mapping and localization
CN109558902A (en) A kind of fast target detection method
CN109829435A (en) A kind of method of video image processing, device and computer-readable medium
CN107133607B (en) Demographics' method and system based on video monitoring
CN109145904A (en) A kind of character identifying method and device
CN109523595A (en) A kind of architectural engineering straight line corner angle spacing vision measuring method
CN106780551B (en) A kind of Three-Dimensional Moving Targets detection method and system
Méndez et al. In-field estimation of orange number and size by 3D laser scanning
CN112784873A (en) Semantic map construction method and equipment
CN108961330A (en) The long measuring method of pig body and system based on image
CN108399627A (en) Video interframe target method for estimating, device and realization device
Kluger et al. Cuboids revisited: Learning robust 3d shape fitting to single rgb images
CN109614990A (en) A kind of object detecting device
CN108364300A (en) Vegetables leaf portion disease geo-radar image dividing method, system and computer readable storage medium
JP2011243188A (en) Image processing apparatus, cell classifying apparatus, incubator, image processing method, cell classifying method, image processing program, and cell classifying program
Chrysostomou et al. Optimum multi-camera arrangement using a bee colony algorithm
Li et al. A survey on visual perception for RoboCup MSL soccer robots
Jahangiri et al. Information pursuit: A Bayesian framework for sequential scene parsing
CN109657601B (en) Target team length statistical method based on target detection algorithm and clustering algorithm

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