Fast and accurate indoor occupancy detection is critical for energy efficiency and emergency rescue in the fields of smart building and indoor positioning. However, existing image-based indoor occupancy detection models often neglect small human targets and suffer from large parameters, compromising detection accuracy, real-time performance, and deployment on resource-constrained devices. To address these issues, this study proposes a modified lightweight indoor occupancy detection model based on YOLO v8. Firstly, a patch expanding layer is added to the neck of the YOLO v8 model for reshaping the feature maps of adjacent dimensions into higher-resolution feature maps. Secondly, the standard convolution in the original neck is replaced with the GSConv, boosting the non-linear representation by adding DSC layers and a shuffle operation, efficiently preserving hidden connections between channels. Additionally, the VoV-GSCSP in the neck is designed to adopt one-shot aggregation with GS bottlenecks based on GSConv, followed by a cross-stage partial network module. Experiments on the SCUT-HEAD dataset show the modified lightweight YOLO v8 reduces parameters by 9.3% and computational complexity by 8.6%, while increasing mAP50 by 1.4% compared to the baseline. The proposed model can detect indoor occupancy in a fast and precise manner.