AI-based automatic detection technology for rip currents
Article

AI-based automatic detection technology for rip currents

Object detection and image classification

To support the prevention of casualties from rip currents, the Korea Hydrographic and Oceanographic Agency (KHOA) applied object detection and image classification technologies to real-time rip current monitoring systems. Such technologies have recently attracted attention in the fields of AI and computer vision. They make it possible to identify rip currents in real-time images and to transmit information about their occurrence to monitoring personnel, thereby enabling immediate response.

Rip currents, regarded as one of the main causes of accidents at swimming beaches during the summer season, are strong and narrow currents of seawater that flow from the coast to the open sea and mainly occur on beaches with a broad, gentle slope. Rip currents occur briefly then disappear, often in good weather conditions, making it difficult to observe them directly at the coast and to identify their characteristics. To address this issue, the KHOA started to apply AI and computer vision technologies such as object detection and image classification in high-risk rip current areas (see Figure 1) where real-time rip current monitoring systems are operational. Transmitting information about the occurrence of rip currents to personnel enables a rapid response before an incidence can occur.

Development of automatic rip current detection technology

The KHOA developed the automatic rip current detection technology at Haeundae Beach; an area with frequent rip currents and many cases of casualties with distinct occurrence patterns that is covered by a real-time rip current monitoring system. This technology applied Ultraltytics’ YOLOv8 (You Only Look Once, version 8) object detection model based on CCTV images of a real-time rip current surveillance system. Unlike existing object detection models that search for regions of interest in an image multiple times using a sliding window or examine multiple candidate regions using a region proposal method, YOLOv8 detects objects by looking at the entire image at once, which significantly improves the detection speed compared to existing models and makes it applicable to real-time object detection.

Figure 1: Rip current monitoring sites

The operating principle of YOLOv8 is as follows (see Figure 2):

  • Image segmentation (grid division): The input image is divided into N×N grids, where each grid cell judges the possibility of an object existing in the image.
  • Bounding box prediction: Each grid cell predicts multiple bounding boxes and the confidence score of each box.
  • Class probability prediction: The probability that each bounding box belongs to a specific object class is predicted.
  • Non-maximum suppression (NMS): The final detection result is derived by keeping the box with the highest confidence among the overlapping boxes and removing the rest.

For the YOLOv8 model to detect rip currents, the researchers needed to train it with images of rip currents and information about them. Three years’ worth of data was used to build training data using images from four CCTVs located at Haeundae Beach to verify the algorithm. Two classes could be identified in the CCTV images: RipCurrent and RipDoubt. RipCurrent refers to a case where a rip current clearly occurs and the flow out of water is visible. RipDoubt, however, refers to a case where the shape of the rip current is unclear. A breaking wave shape, such as a break in the advancing wave crest or two or more wave crests crossing, also shows that a rip current has occurred. In addition, a non-rip current image was added as a background to prevent the false detection of rip currents in situations where no rip currents arise.

Figure 2: The example of YOLOv8.

Learning, verification and testing images

The final dataset consisted of 58,000 images. These were divided, using a specific ratio, into learning, verification and testing images. The YOLOv8 model was developed using the learning and verification data for training and evaluated using the test data. The performance was evaluated by calculating precision (the ratio of correctly predicted objects, indicating the probability that the object predicted as A is A), recall (how many of the objects that should be correct were correct and how many of the images with multiple objects called A were verified as A), and mAP (mean average precision; a value that calculates the average precision in various categories and is an indicator of the accuracy of model prediction in multiple classes (RipCurrent, RipDoubt)).

The performance index for the CCTV images showed that the precision was 0.903 (90.3%), the recall 0.917 (91.7%), and the mAP 0.950 (95.0%), all showing excellent verification performances of over 90% (Figure 3).

A rip current automatic detection process was built using the developed model and performed for each frame of the real-time CCTV images. If a rip current detection lasted for less than eight seconds it was considered ‘not detected’; if it lasted eight to 11 seconds it was considered a ‘preliminary detection’, and if it lasted for more than 11 seconds it was considered an ‘actual detection’. The rip current occurrence time is shown on the screen and flashes to alert monitoring personnel if it exceeds a limit.

Figure 3: Examples of prediction of a rip current using CCTV with YOLOv8 at Haeundae in Busan.

Conclusion

Rip currents, which are difficult to predict, are threatening natural phenomena that occur on beaches and can cause fatal accidents. Technology that quickly detects and accurately classifies these rip currents is essential for maritime safety. By combining the automatic rip current detection technology developed through this study with real-time images from a real-time rip current monitoring system, a system that can respond more precisely and quickly to rip current occurrences has been established. This technology could be applied to more beaches and marine environments in the future to accumulate data and improve the performance of the constructed model. This would reduce the loss of life caused by rip currents and create a safer ocean.

Hydrography Newsletter

Value staying current with hydrography?

Stay on the map with our expertly curated newsletters.

We provide educational insights, industry updates, and inspiring stories from the world of hydrography to help you learn, grow, and navigate your field with confidence. Don't miss out - subscribe today and ensure you're always informed, educated, and inspired by the latest in hydrographic technology and research.

Choose your newsletter(s)