跳到正文
DEV Community· Don Moskaluk·· 3 小時前AI 評分40

Forward Watch:以 YOLOv8 偵測休閒船隻航行障礙

Forward Watch

AI 導讀

Forward Watch 是開源 Signal K 插件,採用為海上環境自訂訓練的 YOLOv8,在 Raspberry Pi 4 或更新型號上以 CPU 偵測船隻、浮標、皮艇、漂浮物及漂浮木材。

正文

AI Object Detection for Recreational Boats

Every skipper knows the moment: a log just under the surface, a kayak hidden in sun glare, or a small boat with no AIS crossing ahead at dusk. Keeping a proper lookout is a legal and practical duty, but human eyes get tired.

Forward Watch is an AI-powered assistant to that lookout. It is an open-source Signal K plugin, published on npm as signalk-forward-watch, and it's part of the d3kOS platform.

The Problem

Many of the hazards that matter most to recreational boaters are invisible to electronics:

  • Debris and logs don't transmit anything.

  • Kayaks, paddleboards and small boats usually have no AIS.

  • Buoys are on the chart, but not always where you expect in poor visibility.

  • Radar may not be fitted, and small or low targets can be hard to pick out.

A camera can see these objects. The challenge is having something watch that camera continuously and say something only when it matters.

YOLO Technology

Forward Watch uses YOLOv8 ("You Only Look Once"), a widely used real-time object detection architecture. The model is custom-trained for the marine environment and detects six classes:

ClassExampleshipLarge commercial vesselsboatRecreational and small craftdebrisFloating hazardsbuoyNavigation and mooring buoyskayakKayaks and similar paddle craftlogFloating logs

Some technical details:

  • CPU inference. It runs on a Raspberry Pi 4 or better, with no GPU required.

  • Worker thread. The model runs (via ONNX) in a separate worker thread, so detection never slows down the Signal K server.

  • Model included. The detection model ships inside the package, and the plugin never contacts the network for model data.

  • Confidence threshold. Adjustable, with a starting default of 0.4.

Camera Systems

Forward Watch needs a bow-mounted IP camera with an RTSP stream:

  • ONVIF cameras can be discovered automatically, or you can enter an RTSP URL.

  • Frames are captured with ffmpeg at a configurable interval.

  • Your boat's GPS position must be available in Signal K so detections can be placed on the chart.

Each detection includes the object class, a confidence score, an estimated bearing, the side of the bow (port or starboard), an estimated distance, and an estimated latitude and longitude.

About distance: Forward Watch uses a single camera, so distance is estimated from the size of the object in the frame. Treat it as a rough range indicator, not a measurement.

Alerts and Notifications

Early field testing showed that a detector which alarms on every frame quickly becomes a detector everyone ignores. Version 0.2.5 adds alert logic designed for real boats:

  • Persistence. An alarm is raised only after a target is seen on 3 consecutive checks, or immediately if the estimated distance is 75 m or less.

  • Auto-clear. The alert returns to normal after the target is gone for 2 checks.

  • Moored suppression. No alarms below 1.0 knot, although detections are still published. This stops false alarms at the dock.

Detections reach the skipper in several ways:

  • Signal K data at environment.forwardWatch.detections

  • Signal K notifications at notifications.forwardWatch.

  • Chart targets. Each class is written as a vessel with a fixed identifier (labelled FW-SHIP, FW-BOAT and so on), so it updates in place on chart displays. OpenCPN users with a Signal K connection see these targets automatically. Standalone chartplotters can display them through the @signalk/signalk-to-nmea0183 plugin. In d3kOS's AvNav charts they appear in the "other" target category.

Real-World Use Cases

  • Night and dusk passages. An extra set of "eyes" on the bow when contrast is poor.

  • Debris-prone waters. Spring runoff and storm debris in lakes and rivers.

  • Busy channels. Small non-AIS craft mixed with commercial traffic.

  • Fishing boats. The skipper's attention is often on the electronics and the lines, not the horizon.

In replay testing with real recorded footage from a boat, the v0.2.5 alert logic cut false alarms while moored from 97 to zero and still detected the commercial ships the boat passed underway.

Honest Limitations

Forward Watch is an aid, not a lookout replacement:

  • Single-camera distance estimates are approximate.

  • Glare, spray, fog and darkness reduce detection quality.

  • Model training on more real-world marine footage is ongoing.

  • It needs a GPS fix to place targets on the chart.

Frequently Asked Questions

Can I use Forward Watch without d3kOS? Yes. It's a standard Signal K plugin you can install on a Signal K server. It's tested on Signal K Node Server 2.x on Raspberry Pi OS.

Does it need a GPU? No. It runs on the CPU of a Raspberry Pi 4 or newer.

Does it replace radar? No. Cameras and radar have different strengths. Forward Watch adds visual detection of objects that may not show up on other sensors.

來源:DEV Community · dev.to