This research automates edge detection for perovskite crystal grains using machine learning (ML). Once the edges of the crystal grains are located, a flood-fill algorithm can be used to find the distribution of crystal grain areas. The ML algorithm uses GNU Octave to run a regularized logistic regression algorithm that classifies each pixel of an input image as part of an edge or not part of an edge. The basic features used for the algorithm are each pixel’s grayscale intensity, its Sobel derivative. Higher order Sobel derivatives, higher degree polynomial terms, and intensities convolved by various kernels were used as additional features to improve the program’s accuracy and true-positive rate. Training data is obtained by using non-ML Canny Edge Detection to annotate the edges an SEM image of a pure perovskite solar cell (PSC). The classifier exhibits an 85.58% accuracy and produces an edge mask that clearly outlines the crystals visually. The ML edge mask exhibits far fewer false-positive mis-classifications for pixels in the middle of the crystals than Canny. However, the ML mask’s edges are fainter, owing to a lower true-positive classification rate. Using more kernels, higher order derivatives, and higher degree polynomial terms all significantly increased the true positive rate of the classifier, leading to thicker edges. This algorithm can greatly accelerate perovskite solar cell research (and potentially any research requiring particle size analysis), automating a process scientists previously had to perform by hand. This will facilitate the search for a solution for the world’s growing demands for renewable energy.