Off-the-job monitoring and early warning system yolov5

The off-post monitoring and early warning system can use the python+yolov5 network model deep learning algorithm and off-post monitoring and early warning algorithm to monitor the positions of on-site personnel in real time, automatically identify whether there is off-post behavior, and issue an alarm in time. Yolo means You Only Look Once, it does not really remove the candidate area, but creatively combines the candidate area and the target classification into one, and you can know which objects are there and where they are at a glance at the picture. The Yolo model uses the method of pre-defining the prediction area to complete the target detection. Specifically, the original image is divided into 7x7=49 grids (grid), and each grid allows the prediction of 2 bounding boxes (bounding box, containing a certain The rectangular box of the object), a total of 49x2=98 bounding boxes. We understand it as 98 prediction areas, which roughly cover the entire area of ​​the picture, and target detection is performed in these 98 prediction areas.

The structure of YOLO is very simple, that is, simple convolution and pooling and two layers of full connections are added at the end. From the perspective of network structure, there is no essential difference from the CNN classification network introduced earlier. The biggest difference is that the output layer is made of linear functions. Activation function, because it is necessary to predict the position of the bounding box (numeric type), not just the probability of the object. So roughly speaking, the entire structure of YOLO is that the input image is transformed by the neural network to obtain an output tensor. In YOLOv5, the Mosaic data enhancement method is still used in the training model stage, which is improved on the basis of the CutMix data enhancement method. CutMix only uses two pictures for stitching, while the Mosaic data enhancement method uses 4 pictures, and stitches them according to random scaling, random cropping and random arrangement.

The YOLOv5 algorithm has four versions, including: YOLOv5s, YOLOv5m, YOLOv5l, and YOLOv5x. This article focuses on YOLOv5s, and other versions deepen and widen the network on the basis of this version.

  • Input - The input represents the input image. The input image size of the network is 608*608, and this stage usually includes an image preprocessing stage, which is to scale the input image to the input size of the network, and perform operations such as normalization. In the network training phase, YOLOv5 uses Mosaic data enhancement operations to improve the training speed of the model and the accuracy of the network; and proposes an adaptive anchor frame calculation and adaptive image scaling method.
  • Benchmark network - The benchmark network is usually a network of classifiers with excellent performance, and this module is used to extract some general feature representations. Not only the CSPDarknet53 structure is used in YOLOv5, but also the Focus structure is used as the benchmark network.
  • Neck network -Neck network is usually located in the middle of the benchmark network and the head network, and it can further improve the diversity and robustness of features. Although YOLOv5 also uses the SPP module and the FPN+PAN module, the implementation details are somewhat different.
  • Head output terminal - Head is used to complete the output of target detection results. For different detection algorithms, the number of branches at the output end is different, usually including a classification branch and a regression branch. YOLOv4 uses GIOU_Loss to replace the Smooth L1 Loss function, thereby further improving the detection accuracy of the algorithm.

The Adapter interface defines the following methods:

public abstract void registerDataSetObserver (DataSetObserver observer)

Adapter represents a data source. This data source may change, such as adding data, deleting data, and modifying data. When the data changes, it must notify the corresponding AdapterView to make corresponding changes. In order to realize this function, the Adapter uses the observer mode. The Adapter itself is equivalent to the observed object, and the AdapterView is equivalent to the observer. Register the observer for the Adapter by calling the registerDataSetObserver method.

public abstract void unregisterDataSetObserver (DataSetObserver observer)

Unregister the observer by calling the unregisterDataSetObserver method.

public abstract int getCount () returns the number of data in the Adapter.

public abstract Object getItem (int position)

The data in the Adapter is similar to an array, and each item in it corresponds to a piece of data, and each piece of data has an index position, that is, position, and the corresponding data item in the Adapter can be obtained according to the position.

public abstract long getItemId (int position)

Get the id of the specified position data item, usually the position will be used as the id. In Adapter, relatively speaking, position is used more frequently than id.

public abstract boolean hasStableIds ()

hasStableIds indicates whether the id of the original data item will change when the data source changes. If it returns true, it means the Id remains unchanged, and if it returns false, it means it may change. The hasStableIds method of Adapter subclasses (including direct subclasses and indirect subclasses) provided by Android all return false.

public abstract View getView (int position, View convertView, ViewGroup parent)

getView is a very important method in Adapter, which will create corresponding UI items for AdapterView according to the index of the data item.

Guess you like

Origin blog.csdn.net/KO_159/article/details/130940692