This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

11institutetext: Yassir Zardoua (Corresponding author)22institutetext: 22email: [email protected] 33institutetext: Boulaala Mohammed 44institutetext: 44email: [email protected] 55institutetext: Abdelhamid EL WAHABI 66institutetext: 66email: [email protected]
Astito Abdelali
77institutetext: 77email: [email protected]

1Laboratory of Informatics, Systems & Telecommunications, FSTT, Abdelmalek-Essaadi University, Tetouan, Morocco

A horizon line annotation tool for streamlining autonomous sea navigation experiments

Yassir ZARDOUA1    Abdelhamid EL WAHABI    Mohammed BOULAALA1
   Abdelali ASTITO1    Mhamed EL MRABET
Abstract

Horizon line (or sea line) detection (HLD) is a critical component in multiple marine autonomous navigation tasks, such as identifying the navigation area (i.e., the sea), obstacle detection and geo-localization, and digital video stabilization. A recent survey highlighted several weaknesses of such detectors, particularly on sea conditions lacking from the most extensive dataset currently used by HLD researchers. Experimental validation of more robust HLDs involves collecting an extensive set of these lacking sea conditions and annotating each collected image with the correct position and orientation of the horizon line. The annotation task is daunting without a proper tool. Therefore, we present the first public annotation software with tailored features to make the sea line annotation process fast and easy. The software is available at: https://drive.google.com/drive/folders/1c0ZmvYDckuQCPIWfh_70P7E1A_DWlIvF?usp=sharing.

1 Introduction

1.1 Definition of the horizon line

In maritime images captured from terrestrial platforms, such as buoys, ships, and USVs, the horizon feature (sometimes called the sea-sky line) is defined as the line separating the sea region and the region right above it zardoua2021survey (1) (see Figure 1 and 1). The literature includes several ways to represent the location of the horizon line. The position and tilt representation, which we denote by the pair of parameters {Y,ϕ}\{Y,\phi\} (see Figure 1), is by far the most common and useful representation zardoua2021survey (1, 2) because it provide a direct and precise measure of the horizon’s location. Additionally, measuring the detection error based on this representation provides a clear and intuitive idea of how well the horizon detection algorithm is performing.

Refer to caption
Refer to caption
Refer to caption
Figure 1: Definition and representation of the horizon: the horizon line separates the sea from the sky (a) and the sea from the coast (b); (c) {Y,ϕ}\{Y,\phi\} representation on Cartesian coordinates xyxy of images

1.2 Applications of the horizon line

The published literature shows that the sea horizon line exhibits a wide range of applications, especially in terms of autonomous navigation. In the case of autonomous sea navigation, the horizon feature is involved on almost every stage of the processing pipeline. We’ll cite four major application categories. First, numerous papers and patents used the horizon line to auto-calibrate the camera rs13142795 (3, 4, 5), which include non-maritime scenes as well calibration (6, 7). Second, the position and tilt of the horizon allows the computation of rotational and translational matrices that would digitally stabilize captured video frames overview_stabilization (8, 9, 10, 11, 12, 13, 14, 15, 16). A stabilized video is not only easier to watch but facilitates subsequent analyses as well Reichert2021 (16, 2, 10). Third, many works used the horizon to segment the image (into sea and non-sea region). In the same context, the horizon feature provides computational benefits to the object detection task by reducing the search region down to that around the horizon or by eliminating the sky pixels that will obviously not depict any obstacle asv (17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 4, 34). Fourth, even after the detection of maritime objects on the image coordinates, some researchers used the horizon line to geo-localize surrounding objects and obstacles 6070512 (35, 36, 37, 38), i.e., find the distance in meters from the camera to the obstacle.

1.3 The need of custom horizon annotation tool

Our decision to develop and publicly share our annotation tool was driven by the need for a fast and reliable sea line annotation tool, which we clarify in the following points:
•  the most extensive dataset, the SMD, lacks various sea conditions that must be collected and properly annotated
•  the sea line annotation of the SMD include significant mistakes and must be corrected before the experiment
•  many papers such as liang (39, 40, 10, 12) include their own private image dataset but do neither mention how did they annotate their image nor share their annotation tool.
•  currently available tools, such as LabelMe and SuperAnnotate, lack public free access and customization. The proposed software freely provide unique and tailored features and can be directly used without further modifications.

Section 2 outlines the primary components and features of the proposed software, which are summarized below: •  An intuitive graphical user interface (GUI) and easy browsing through video frames
•  Visualization tools, such as the ability to adjust the thickness of the annotated sea line
•  The option to duplicate current annotations onto previous non-annotated frames, which is particularly useful for on-shore fixed cameras
•  Shortcut keys and the ability to annotate all video frames with just the mouse
•  Misuse warnings, such as alerting the users if they forget to annotate all the frames
•  The ability to save incomplete annotation files and return to them later for completion, which is especially helpful for video files with a large number of frames.

Overall, these features enhance the functionality and user-friendliness of the software and make it a valuable tool for video annotation.

2 Description of the application: interface blocks and features

Figure 2 shows the first interface that pops-up when running the application. It is subdivided into four blocks: image display, load directories, browse, and annotation. This Section discusses the full details of each of mentioned blocks.

Refer to caption
Figure 2: The GUI before video loading

2.1 Load directories block

Load directories is the first block to use. As shown in Figure 3, the block contains three self-explanatory buttons: load video file, save annotated file, and load existing gt file. The software supports two video file formats: .avi and .mp4. The loaded video will appear on the Image display block, which we detail in Section 2.2. The third button (load existing gt file) allows the user to start the annotation process from an existing annotated file (also known as the Ground Truth file). As the user browses through the video frames, the annotated line of the viewed frame will be drawn in red, as shown in Figure 4. Such a feature allows the user to review the annotated frames and correct the eventual mistakes. Whether the user annotates the video from scratch or starts the annotation from an existing GT (Ground Truth) file, clicking on the save annotated file will always save in the directory specified by the user an annotation file by suffixing the current video file name with LineGT.npy.

Refer to caption
Figure 3: The Load directories block
Refer to caption
Refer to caption
Figure 4: The GUI after loading (a) a video file and an (b) existing annotation file.

2.2 Image display block

The image display block will show the first frame of the loaded video file. The frame size will not change as long as the entire GUI fits into the computer screen. Otherwise, the frame will be down-scaled to the size that would allow the entire GUI to fit onto the computer screen. If the current frame corresponds to an annotated line, that line will be automatically drawn and shown on the displayed frame. The user can draw the annotation line by maintaining the left mouse button. one that button is released, the application will automatically infer and draw the full line on the image display, as shown in Figure 5. If the user is not satisfied with the line he is drawing, i.e., before releasing the left button of the mouse, he can abort the drawing process by right-clicking the mouse before releasing the left mouse button. While the mouse is on the image display, its Cartesian Coordinates (x,y)(x,y) are constantly updated and displayed on the bottom left of the Image display block, as shown in Figure 6. We note that the image frame displayed in Figure 5 is downsized so that the GUI fits in the screen.

Refer to caption
Refer to caption
Figure 5: The process of line drawing: (a) before releasing the left mouse button; (b) after releasing the left mouse button; (c) the mouse position coordinates.
Refer to caption
Figure 6: Cartesian coordinates (x,y)(x,y) of the current mouse position

Even in such a case, the Cartesian coordinates displayed are computed to correspond to the original size of the frame. This choice is not arbitrary for two reasons: (1) the downsizing factor changes according to the frame size and the computer screen; (2) the position of the annotated line must correspond to the original frame size.

2.3 Annotation block

We show the annotation block in Figure 7. The features of this block involve the manipulation of annotated lines. The Validate button validates the non-aborted line drawn, such as the line we mentioned in Figure 5. The Delete button deletes the annotated line of the current frame. The Hide button hides the annotation of the current frame. It can be shown again using the Show button. Instead of using these buttons, the user may prefer keyboard keys. The key corresponding to each button is written between parenthesis (e.g., (v) for Validate button). Section 4 provides a keymap containing the full list of the GUI shortcuts.

Refer to caption
Figure 7: The Annotation block

The Annotated line thickness shown under the four buttons in Figure 7 is a text entry that allows the user to specify the thickness of the annotated line. We note that such a thickness is not an annotation information and serves only a visualization purpose. This entry has built-in features to handle non-conforming thickness values, such as texts or negative numbers. The last element of the annotation block is the Current annotation, which displays the position and tilt of the annotated line. When no annotation line exists for the current frame, the values displayed will be replaced by three interrogation marks ???.

2.4 Browse block

After loading a video file, drawing a line, and validating it using the Validate Button or its corresponding shortcuts, the user will browse to the next frames. The Browse block and its features ensure easy browsing through the video frames. As we show in Figure 8, the two buttons <<<< and >>>> browse to the previous and next frames, respectively. Easier browsing alternatives are listed in Section 4.

Refer to caption
Figure 8: The Browse block

Right under the two browsing buttons, the interface shows the index of the current frame and the total number of frames. The browsing offset defaults to 1. This means that the index of the next (or previous) frame is equal to the index of the current frame + 1 (or - 1). Browsing with an offset of 1 slows down the browsing process when the video file has a large number of frames. Thus, the user can quickly go to any video frame by changing the browsing offset in the Enter a browsing offset entry.

3 Annotation files

The annotation files take the .npy format, which can be loaded on Python using the Numpy package numpy (41). Each .npy file will contain NN rows, where NN is the number of frames in the corresponding video file. We note that even if the user does not annotate all the frames, the number of rows in the saved .npy will always be NN. Each row contains five columns, and each column is a scalar number representing the following parameters: YY, ϕ\phi, xsx_{s}, xex_{e}, ysy_{s}, yey_{e}, where YY is the line position in pixels, ϕ\phi is the line tilt in degrees, (xs,ys)(x_{s},y_{s}) are Cartesian coordinates of the starting point, and (xe,ye)(x_{e},y_{e}) are Cartesian coordinates of the ending point. We visually illustrate these five parameters in Figure 9. We note that ϕ\phi is zero when the line is horizontal and increases in the anti-clockwise rotation; for instance, the line in Figure 9 has a positive tilt value (ϕ>0)(\phi>0). We note that non-annotated frames will correspond to rows where scalars YY, ϕ\phi, xsx_{s}, xex_{e}, ysy_{s}, and yey_{e} will be np.nan, which is the Numpy object for Not A Number.

Refer to caption
Figure 9: The line parameters saved in the annotation files

4 Keymap for quick and easy annotation

This Section lists all the shortcut keys we chose to quickly and easily annotate a video file. These keys allow the user to annotate an entire video file with minimal hand movement. For instance, the keymap in Table 1 indicates that the user can annotate the entire video file using the mouse only: draw a line with the left mouse button, validate that line with the right mouse button, and browse to the next frame by rotating the mouse wheel instead of clicking on the next button (>>>>) shown in Figure 8. Another significant productivity feature in our software is the annotation replication, which can be done using the w key. For instance, let’s assume that the camera does not move for a given period, which is very likely to happen for cameras on non-moving platforms such as shore pylons. The SMD EOsurvey2017 (2) contains more than 17,222 video frames captured with such a camera set-up. If the period we just mentioned lasts, for instance, only five seconds, there would be 150150 frames1115×5\times Frames per seconds = 5×305\times 30 where the horizon’s position and orientation is the same (because the camera’s position and orientation is the same). In other words, all 150150 frames we mentioned will have the same annotation. In such a case, the user should browse to the 150150-th non-annotated frame, annotate it, and then click on the w key to replicate that annotation on all the previous 149149 non-annotated frames. This is much easier and faster than drawing and validating a line for each of the 150150 non-annotated frames. Table 1 shows the complete list of keys facilitating the annotation process.

Table 1: Keymap of the GUI
Keys Actions
Mouse wheel (roll-up) Browse to the next frame
Right arrow key (\rightarrow) Browse to the next frame
Mouse wheel (roll-down) Browse to the previous frame
Left arrow key (\leftarrow) Browse to the previous frame
v Validate the drawn line
Left mouse button Validate the drawn line
w Replicate the annotation of the current frame on all previous non-annotated frames
s Show the annotated line (if it exists)
h Hide the annotated line (if it exists)
d Delete the annotated line
Enter key Validates entered texts (e.g., Annotated line thickness in Figure 7)

5 Message boxes

The GUI includes several message boxes to guide the user or warn him with relevant information. Figure 10 shows message box examples that would pop-up when the user tries to save an annotation file with missing annotations or enters an invalid browsing offset.

Refer to caption
Refer to caption
Figure 10: Two instances of message boxes

6 Conclusion

We proposed in this paper a horizon line annotation software and justified its importance in several aspects, which include the lack of current public datasets in terms of more maritime conditions as well as the mistakes in their annotation files, the preference of researchers to collect an annotate their own maritime images, and the absence of a free public software dedicated to the horizon annotation task. We discussed and described all blocks of the graphical user interface. More importantly, we provided a complete keymap list that corresponds to several productivity features we designed to quickly and easily annotate the video frames. We provided the software as one file that would install all required files, including the executable application Horizon Annotator.exe.

References

  • (1) Yassir Zardoua, Abdelali Astito and Mohammed Boulaala “A survey on horizon detection algorithms for maritime video surveillance: advances and future techniques” In The Visual Computer, 2021 DOI: 10.1007/s00371-021-02321-0
  • (2) Dilip K Prasad et al. “Video processing from electro-optical sensors for object detection and tracking in a maritime environment: a survey” In IEEE Transactions on Intelligent Transportation Systems 18.8 IEEE, 2017, pp. 1993–2016
  • (3) Gonzalo Simarro, Daniel Calvete and Paola Souto “UCalib: Cameras Autocalibration on Coastal Video Monitoring Systems” In Remote Sensing 13.14, 2021 DOI: 10.3390/rs13142795
  • (4) Bok-Suk Shin, Xiaozheng Mou, Wei Mou and Han Wang “Vision-based navigation of an unmanned surface vehicle with object detection and tracking abilities” In Machine Vision and Applications 29.1, 2018, pp. 95–112 DOI: 10.1007/s00138-017-0878-7
  • (5) Amin Assadzadeh et al. “Automatic far-field camera calibration for construction scene analysis” In Computer-Aided Civil and Infrastructure Engineering 36.8 Wiley Online Library, 2021, pp. 1073–1090
  • (6) Wende Zhang and Sanjeev M Naik “Camera auto-calibration by horizon estimation” US Patent 8,259,174 Google Patents, 2012
  • (7) Anas Ali and Pavel Smrz “Camera auto-calibration for complex scenes” In Thirteenth International Conference on Machine Vision 11605, 2021, pp. 116051W International Society for OpticsPhotonics
  • (8) Yassir Zardoua, Abdelali Astito, Mohammed Boulaala and Yassir Dokkali “A Short Overview of Horizon Detection Methods Applied to Maritime Video Stabilization” In Advanced Intelligent Systems for Sustainable Development (AI2SD’2020) Cham: Springer International Publishing, 2022, pp. 857–864
  • (9) Chengtao Cai, Xiangyu Weng and Qidan Zhu “Sea-skyline-based image stabilization of a buoy-mounted catadioptric omnidirectional vision system” In EURASIP Journal on Image and Video Processing 2018.1 Springer, 2018, pp. 1
  • (10) Sergiy Fefilatyev, Dmitry Goldgof, Matthew Shreve and Chad Lembke “Detection and tracking of ships in open sea with rapidly moving buoy-mounted camera system” In Ocean Engineering 54 Elsevier, 2012, pp. 1–12
  • (11) Yunfei Ma and Huan Wang “Video Stabilization for Sea Scenes via Low-Rank Alignment and effective Visual Cues” In 2021 China Automation Congress (CAC), 2021, pp. 5852–5857 DOI: 10.1109/CAC53003.2021.9728058
  • (12) Michael Schwendeman and Jim Thomson “A horizon-tracking method for shipboard video stabilization and rectification” In Journal of Atmospheric and Oceanic Technology 32.1, 2015, pp. 164–176
  • (13) Yun Peng Liu, Ren Fang Wang, Hui Xia Xu and De Chao Sun “Shipborne Camera Video Stabilization Base on Horizon” In Vehicle, Mechatronics and Information Technologies II 543, Applied Mechanics and Materials Trans Tech Publications Ltd, 2014, pp. 2770–2774 DOI: 10.4028/www.scientific.net/AMM.543-547.2770
  • (14) Yi-Sheng Yao “Electronic stabilization and feature tracking in long image sequences” University of Maryland, College Park, 1995
  • (15) Zoran Duric and Azriel Rosenfeld “Image sequence stabilization in real time” In Real-time imaging 2.5 Academic Press, 1996, pp. 271–284
  • (16) Gijs M. W. Reichert, Marcos Pieras, Ricardo Marroquim and Anna Vilanova “Stabilization and visual analysis of video-recorded sailing sessions” In Visual Computing for Industry, Biomedicine, and Art 4.1, 2021, pp. 26 DOI: 10.1186/s42492-021-00093-x
  • (17) Nuno Pires, Jonathan Guinet and Elodie Dusch “ASV: an innovative automatic system for maritime surveillance” In Navigation 58.232, 2010, pp. 1–20
  • (18) Dalei Qiao et al. “Automated Full Scene Parsing for Marine ASVs Using Monocular Vision” In Journal of Intelligent & Robotic Systems 104.2, 2022, pp. 37 DOI: 10.1007/s10846-021-01543-7
  • (19) Xiangyu Kong, Lei Liu, Yunsheng Qian and Minjie Cui “Automatic detection of sea-sky horizon line and small targets in maritime infrared imagery” In Infrared Physics and Technology 76, 2016, pp. 185–199 DOI: https://doi.org/10.1016/j.infrared.2016.01.016
  • (20) Yiming Bai, Sudan Lei and Lichuan Liu “The Ship Target Detection Based on Sea-Sky-Line” In 2021 6th International Conference on Automation, Control and Robotics Engineering (CACRE), 2021, pp. 456–460 IEEE
  • (21) Jung Min Lee, Kyung Ho Lee, Byeongwook Nam and Yuepeng Wu “Study on Image-Based Ship Detection for AR Navigation” In 2016 6th International Conference on IT Convergence and Security (ICITCS), 2016, pp. 1–4 DOI: 10.1109/ICITCS.2016.7740373
  • (22) Xiongfei Shan et al. “Sea–Sky Line and Its Nearby Ships Detection Based on the Motion Attitude of Visible Light Sensors” In Sensors 19.18, 2019 DOI: 10.3390/s19184004
  • (23) Wenkun Bian and Qidan Zhu “The ship target detection based on panoramic images” In 2015 IEEE International Conference on Mechatronics and Automation (ICMA), 2015, pp. 2397–2401 DOI: 10.1109/ICMA.2015.7237862
  • (24) Gazi Kocak, Shigehiro Yamamoto and Takeshi Hashimoto “Analyzing Influence of Ship Movements on Stereo Camera System Set-up on Board Ship” In Marine Engineering 47.6, 2012, pp. 888–895 DOI: 10.5988/jime.47.888
  • (25) Yang Zhang, Qing-Zhong Li and Feng-Ni Zang “Ship detection for visual maritime surveillance from non-stationary platforms” In Ocean Engineering 141, 2017, pp. 53–63 DOI: https://doi.org/10.1016/j.oceaneng.2017.06.022
  • (26) Liqian Wang et al. “A Review of Methods for Ship Detection with Electro-Optical Images in Marine Environments” In Journal of Marine Science and Engineering 9.12, 2021 DOI: 10.3390/jmse9121408
  • (27) Chang Lin, Wu Chen and Haifeng Zhou “Multi-Visual Feature Saliency Detection for Sea-Surface Targets through Improved Sea-Sky-Line Detection” In Journal of Marine Science and Engineering 8.10, 2020 DOI: 10.3390/jmse8100799
  • (28) Zechuang Chen, Bin Li, Lian Fang Tian and Dong Chao “Automatic detection and tracking of ship based on mean shift in corrected video sequences” In 2017 2nd International Conference on Image, Vision and Computing (ICIVC), 2017, pp. 449–453 DOI: 10.1109/ICIVC.2017.7984596
  • (29) Dongdong Ma, Lili Dong and Wenhai Xu “A Method for Infrared Sea-Sky Condition Judgment and Search System: Robust Target Detection via PLS and CEDoG” In IEEE Access 9, 2021, pp. 1439–1453 DOI: 10.1109/ACCESS.2020.3047736
  • (30) HUANG Ying-dong, Li Jie and FAN Ning-jun “An Algorithm for Locating Naval Ships on the Sea-Sky-Line” In Transactions of Beijing institute of Technology, 2008, pp. 302–305
  • (31) Weiwei Kong and Tianjiang Hu “A Deep Neural Network Method for Detection and Tracking Ship for Unmanned Surface Vehicle” In 2019 IEEE 8th Data Driven Control and Learning Systems Conference (DDCLS), 2019, pp. 1279–1283 DOI: 10.1109/DDCLS.2019.8908899
  • (32) Yueqiang Zhang et al. “Real-time estimation of ship’s horizontal attitude based on horizon tracking” In Optik 126.23, 2015, pp. 4475–4483 DOI: https://doi.org/10.1016/j.ijleo.2015.08.156
  • (33) Junnan Shi, Jiucai Jin and Jie Zhang “Object Detection Based on Saliency and Sea-Sky Line for USV Vision” In 2018 IEEE 4th Information Technology and Mechatronics Engineering Conference (ITOEC), 2018, pp. 1581–1586 DOI: 10.1109/ITOEC.2018.8740763
  • (34) Jingyi Liu et al. “Real-Time Monocular Obstacle Detection Based on Horizon Line and Saliency Estimation for Unmanned Surface Vehicles” In Mobile Networks and Applications 26.3, 2021, pp. 1372–1385 DOI: 10.1007/s11036-021-01752-2
  • (35) Han Wang et al. “A vision-based obstacle detection system for Unmanned Surface Vehicle” In 2011 IEEE 5th International Conference on Robotics, Automation and Mechatronics (RAM), 2011, pp. 364–369 DOI: 10.1109/RAMECH.2011.6070512
  • (36) Jan Brejcha and Martin Čadík “State-of-the-art in visual geo-localization” In Pattern Analysis and Applications 20.3, 2017, pp. 613–637 DOI: 10.1007/s10044-017-0611-1
  • (37) Tomasz Praczyk “Detection of Land in Marine Images” In International Journal of Computational Intelligence Systems 12, 2018, pp. 273–281 DOI: https://doi.org/10.2991/ijcis.2018.125905640
  • (38) Ran Gladstone, Yair Moshe, Avihai Barel and Elior Shenhav “Distance estimation for marine vehicles using a monocular video camera” In 2016 24th European Signal Processing Conference (EUSIPCO), 2016, pp. 2405–2409 IEEE
  • (39) Dong Liang and Ya Liang “Horizon Detection From Electro-Optical Sensors Under Maritime Environment” In IEEE Transactions on Instrumentation and Measurement 69.1 IEEE, 2019, pp. 45–53
  • (40) Fangxu Li et al. “Sea–sky line detection using gray variation differences in the time domain for unmanned surface vehicles” In Signal, Image and Video Processing 15.1, 2021, pp. 139–146 DOI: 10.1007/s11760-020-01733-0
  • (41) Charles R. Harris et al. “Array programming with NumPy” In Nature 585.7825 Springer ScienceBusiness Media LLC, 2020, pp. 357–362 DOI: 10.1038/s41586-020-2649-2