Visual recognition for automated cigarette inventory faces significant hurdles, including illumination changes, diverse box dimensions, and partial feature occlusion, which complicate brand verification and misplaced box detection. This article proposes an improved real-time detection model to deal with image recognition problems and improve accuracy. Firstly, an adaptive downsampling module is deployed to replace the downsampling convolution module in both the backbone and neck networks of YOLO series as the baseline or original detector, which effectively retains more feature details and realizes the lightweight of the model. Secondly, an inverted efficient multi-scale attention module is introduced to capture the spatial context information of different scales and generate a more accurate spatial attention map, which improves the prediction accuracy of the baseline model for complex features and occlusion targets. Finally, a dynamic detection head module replaces theoriginal detection head of the baseline model and performs multi-scale object detection on the feature map extracted from the backbone and neck networks to achieve accurate positioning and category division of the predicted target. To evaluate the performance of the improved model in the field, we constructed a visual dataset of the cigarette box brand. The dataset was augmented using region-specific copy-paste and traditional augmentation techniques, and the obtained dataset includes complex background, occlusion, and overlap, small target, and other factors. The experiment demonstrates that the improved model presented in this article effectively meets the requirements for real-time detection in the field. The proposed model achieves a mAP of 97.9%, with parameters and FLOPs of 1,849,679 and 5.1 G, respectively. Compared with the baseline model, the proposed model improves mAP by 0.9% while reducing parameters by 28.78% and floating-point operations by 1.4 G. Additionally, the model reaches an inference speed of 38.5 FPS, satisfying the requirements for real-time industrial detection.