Energy losses in the electricity distribution and transmission network and electricity theft detection are major challenges of electricity suppliers around the world. Advanced metering infrastructure (AMI) is an essential segment of the smart grids that is responsible for gathering, measuring and analyzing consuming data of customers. The addition of a security layer to AMI has paved the way for the electricity theft in new ways. The analysis of consumed data related to users is one of the essential resources to identify electricity thieves. In this paper, the crow search algorithm (CSA) is improved and the factors of weight (w ) and awareness probability (AP ) are obtained dynamically and used to adjust the parameters c and γ of support vector machine (SVM). The results illustrate that the ICSA-SVM framework has acceptable performance and detects fraudulent customers with a high accuracy.