Agriculture is an important sector for the global economy and the agricultural crop yield can be affected by many factors such as soil, weather, pests, animals, etc. Nowadays, machine learning is also employed in the field of agriculture for applications like crop management, livestock management, soil management, water management and insect or pest detection. This paper presents a comparative analysis of three different machine learning models EfficientNet B3, ResNet 101, and ResNet 152 for the detection of pests. Using the Pest Dataset these models are trained and then deployed on Raspberry Pi for real-time inference. The result demonstrated that Efficientnet B3, when deployed on Raspberry Pi, obtains an accuracy of 97.11%, which is quicker and more accurate than ResNet 101 and ResNet 152.