This paper realizes the estimation of classroom occupancy by using the CO2 sensor and deep learning technique named Long-Short-Term Memory. As a case of connection with IoT and machine learning, I achieve the model to estimate the people number in the classroom based on the environmental data exported from the CO2 sensor, I also evaluate the performance of the model to show the feasibility to apply our module to the real environment.