A fast beam size diagnostic system has been developed at SSRF storage ring for turn-by-turn and bunch-by-bunch beam transverse oscillation study. This system is based on visible synchrotron radiation direct imaging system. Currently, this system already has good experimental results. However, this system still has some limitations, the resolution is subject to the point spread function; and the speed of the online data processing is limited by the complex Gaussian fitting algorithm. In order to realize the online fast data processing, we present a technique that applied machine learning tools to predict transverse beam size. Using this technique at SSRF storage ring, we report mean squared errors below 4 μm for prediction of the horizontal beam size.