At the present stage, most of the packet header detection algorithms in massive access are to solve the problem of multi-user collision in the additive white gaussian noise (AWGN) channel. On the other hand, many algorithms do not consider that the number of user collisions is unknown and varies randomly. First, we propose an adaptive algorithm based on correlation. Secondly, based on the coordinate ascent variational inference (CAVI) algorithms, we present an improved header detection method in fading channels. Compared with the traditional packet head detection method based on compressive sensing reconstruction algorithm, this improved method solves the problem that the number of users who collide is unknown, and it also has good performance in fading channels. In addition, the method can also cope with the random change of the number of users in collision.