Accurate traffic flow prediction can effectively improve traffic efficiency and safety. This has become a trending topic in intelligent transportation systems. However, the occurrence of traffic accidents will cause great fluctuations of traffic flow in a short time, thus affecting the accuracy of flow prediction. This paper analyses the influence of traffic accident information on traffic flow, and proposes a grey convolutional neural network called G-CNN for traffic flow prediction. First, considering the small sample size of traffic accidents and the incomplete information description, the traffic flow and traffic speed change rate are defined to represent traffic accident grey information, and a grey fixed-weight clustering method for extracting the characteristics of traffic accident grey information is established. Second, the spatiotemporal characteristics of traffic flow are analysed, and a third-order tensor is developed to fuse them with the accident characteristics and serve as the input of the G-CNN. Then the G-CNN model is built to predict traffic flow in a traffic accident environment. The Canadian Whitemud Drive experiment on traffic flow without traffic accident information reveals that the developed G-CNN model has a better ability to predict future traffic flow with better accuracy and stability. Meanwhile, it is verified that the fluctuation of the traffic change rate will cause traffic accidents, and the probability of traffic accidents at a certain time point will be obtained through feature extraction of traffic accidents. Finally, the model is verified for the traffic flow of Hangzhou Viaduct in China, which demonstrates that the G-CNN model outperforms all of the compared models.