In order to solve the problem that the traffic flow count model has a large amount of calculation and cannot be used in actual industrial applications, this paper proposes a small model traffic flow count algorithm based on improved YOLOv5n and DeepSORT. In terms of detector, the small model YOLOv5n is used as the detector, and the C3 module of the YOLOv5n model is replaced by the C2f module. At the same time, in view of the poor re-identification effect of the tracker in vehicle tracking, the convolution structure of the DeepSORT algorithm is changed and retrained on the veri-wild vehicle re-identification dataset. We also share our approach to handling public datasets to make them more suitable for different model training. The experimental results show that the total number of parameters of the improved detector model is 2.33 million, and the MAP_0.05 is 60.83%. Compared with the original model, the number of parameters is only increased by 0.57 million, and the mAP_0.5 is increased by 4.01%. The improved detector model increases the detection accuracy of the model while maintaining the lightweight of the original model. The accuracy of the overall model is 6.25% higher than that of the original model. It can also detect traffic flow in real time on devices with poor computing power, and has a good accuracy.