  Understanding the processes of perovskite crystallization is essential for
improving the properties of organic solar cells. In situ real-time
grazing-incidence X-ray diffraction (GIXD) is a key technique for this task,
but it produces large amounts of data, frequently exceeding the capabilities of
traditional data processing methods. We propose an automated pipeline for the
analysis of GIXD images, based on the Faster R-CNN deep learning architecture
for object detection, modified to conform to the specifics of the scattering
data. The model exhibits high accuracy in detecting diffraction features on
noisy patterns with various experimental artifacts. We demonstrate our method
on real-time tracking of organic-inorganic perovskite structure crystallization
and test it on two applications: 1. the automated phase identification and
unit-cell determination of two coexisting phases of Ruddlesden-Popper 2D
perovskites, and 2. the fast tracking of MAPbI$_3$ perovskite formation. By
design, our approach is equally suitable for other crystalline thin-film
materials.
