Skip to content

SemanticWave-Hoyeon/NavtexRecovery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NAVTEX Recovery System

AI-powered restoration system for damaged NAVTEX (NAVigational TEleX) maritime safety messages.

Architecture Frontend Model License: PolyForm Noncommercial

Screenshot

NAVTEX Recovery System Screenshot

Web interface showing real-time NAVTEX message restoration with per-character confidence scores and detailed restoration information.

About

This project provides the implementation of the NAVTEX message restoration model described in the following paper:

Cho, H.; Lee, C.; Lee, S. Comparative Performance Analysis of Software-Based Restoration Techniques for NAVTEX Message. J. Mar. Sci. Eng. 2025, 13, 1657. https://doi.org/10.3390/jmse13091657

Citation

If you use this code in your research, please cite our paper:

MDPI and ACS Style

Cho, H.; Lee, C.; Lee, S. Comparative Performance Analysis of Software-Based Restoration Techniques for NAVTEX Message. J. Mar. Sci. Eng. 2025, 13, 1657. https://doi.org/10.3390/jmse13091657

AMA Style

Cho H, Lee C, Lee S. Comparative Performance Analysis of Software-Based Restoration Techniques for NAVTEX Message. Journal of Marine Science and Engineering. 2025; 13(9):1657. https://doi.org/10.3390/jmse13091657

Chicago/Turabian Style

Cho, Hoyeon, Changui Lee, and Seojeong Lee. 2025. "Comparative Performance Analysis of Software-Based Restoration Techniques for NAVTEX Message" Journal of Marine Science and Engineering 13, no. 9: 1657. https://doi.org/10.3390/jmse13091657

APA Style

Cho, H., Lee, C., & Lee, S. (2025). Comparative Performance Analysis of Software-Based Restoration Techniques for NAVTEX Message. Journal of Marine Science and Engineering, 13(9), 1657. https://doi.org/10.3390/jmse13091657

BibTeX

@article{cho2025navtex,
  title={Comparative Performance Analysis of Software-Based Restoration Techniques for NAVTEX Message},
  author={Cho, Hoyeon and Lee, Changui and Lee, Seojeong},
  journal={Journal of Marine Science and Engineering},
  volume={13},
  number={9},
  pages={1657},
  year={2025},
  publisher={MDPI},
  doi={10.3390/jmse13091657}
}

Project Overview

  • Purpose: AI-based restoration of damaged NAVTEX messages (masked with *)
  • Model: ConstrainedCharBert (Transformer-based)
  • Supported Characters: A-Z, 0-9, special characters (56 + PAD token)
  • Average Accuracy: ~75% (Alphabet: 91%, Digits: 45%, Space: 95%)

Key Features

  • Real-time message restoration
  • Per-character confidence scores with alternative predictions
  • Adjustable confidence threshold (slider)
  • Batch restoration support (up to 100 messages)
  • Intuitive web interface (dark theme)
  • Automatic GPU/CPU detection
  • Processing time and error rate display

System Architecture

+-----------------+      HTTP/REST API      +-----------------+
|                 | <---------------------> |                 |
|  Vue.js 3       |                         |  FastAPI        |
|  Frontend       |    JSON (Request/       |  Backend        |
|                 |     Response)           |                 |
|  - RestoreForm  |                         |  - Model Loader |
|  - ResultView   |                         |  - Restoration  |
|                 |                         |    Service      |
+-----------------+                         +--------+--------+
                                                     |
                                                     v
                                           +-----------------+
                                           | ConstrainedChar |
                                           | BERT Model      |
                                           | (89MB, PyTorch) |
                                           +-----------------+

Project Structure

NAVTEXRecovery/
├── backend/                    # Python backend
│   ├── app/
│   │   ├── api/routes/        # API routers
│   │   ├── core/              # Configuration & model loader
│   │   ├── models/            # ConstrainedCharBert
│   │   ├── schemas/           # Pydantic schemas
│   │   ├── services/          # Business logic
│   │   └── main.py            # FastAPI app
│   ├── weights/
│   │   └── best_model.pt      # Trained model (89MB)
│   └── requirements.txt
│
├── frontend/                   # Vue.js frontend
│   ├── src/
│   │   ├── components/        # Vue components
│   │   ├── composables/       # Composition API
│   │   ├── services/          # API client
│   │   ├── types/             # TypeScript types
│   │   ├── App.vue
│   │   └── main.ts
│   ├── package.json
│   └── vite.config.ts
│
├── model/
│   └── best_model.pt          # Model checkpoint
│
└── README.md

Quick Start

Backend

cd backend

# Create Python virtual environment (Windows)
python -m venv venv
venv\Scripts\activate

# Create Python virtual environment (Linux/Mac)
python3 -m venv venv
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Verify model file exists
# backend/weights/best_model.pt should be present (89MB)
# If not, copy from parent directory:
# cp ../model/best_model.pt weights/

# Run server
python -m app.main
# or
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000

API Documentation: http://localhost:8000/docs

Frontend

cd frontend

# Install dependencies
npm install

# Set environment variables (optional)
# Create .env file
echo "VITE_API_URL=http://localhost:8000/api/v1" > .env

# Run development server
npm run dev

Open http://localhost:5173 in your browser.

API Usage Example

Single Restoration

curl -X POST "http://localhost:8000/api/v1/restore" \
  -H "Content-Type: application/json" \
  -d '{
    "corrupted_text": "ZCZC NA*8 171522 UT* SEP*3",
    "return_confidence": true,
    "min_confidence": 0.7
  }'

Response Example

{
  "corrupted_text": "ZCZC NA*8 171522 UT* SEP*3",
  "restored_text": "ZCZC NA08 171522 UTC SEP23",
  "restorations": [
    {
      "position": 7,
      "original_char": "*",
      "restored_char": "0",
      "confidence": 0.9523,
      "alternatives": [
        {"char": "8", "confidence": 0.0312},
        {"char": "O", "confidence": 0.0089}
      ]
    }
  ],
  "avg_confidence": 0.8756,
  "mask_count": 3,
  "computation_time_ms": 45.2
}

Tech Stack

Backend

  • Python 3.10+
  • PyTorch 2.0+ - Deep learning framework
  • FastAPI 0.104 - Web framework
  • Pydantic 2.5 - Data validation
  • x-transformers - Transformer models

Frontend

  • Vue.js 3 - Progressive Framework
  • TypeScript - Type safety
  • Vite - Build tool
  • Axios - HTTP client

Model Performance

Category Accuracy
Overall ~75%
Alphabet (A-Z) 91.1%
Digits (0-9) 44.6%
Space 95.0%
Special Characters 85.0%

Model Architecture

  • Architecture: ConstrainedCharBert
  • Input: Single character tokens (vocab_size: 57)
  • Output: Constrained character set (56 + PAD)
  • Parameters: ~23M
  • Model Size: 89MB
  • Max Sequence Length: 1024

Model Configuration

  • d_model: 512
  • num_heads: 5
  • depth: 6 (Transformer layers)
  • Rotary Position Embedding
  • Flash Attention
  • RMSNorm

System Requirements

Minimum

  • CPU: 2 cores
  • RAM: 4GB
  • Disk: 1GB

Recommended

  • CPU: 4+ cores
  • RAM: 8GB+
  • GPU: NVIDIA GPU (CUDA support) - optional
  • Disk: 2GB+

API Documentation

After starting the server, API documentation is available at:

Troubleshooting

Model file not found

# Check if backend/weights/best_model.pt exists
ls -lh backend/weights/best_model.pt

# If not, copy from model/ directory
cp model/best_model.pt backend/weights/

Backend server won't start

# Reinstall Python dependencies
cd backend
pip install -r requirements.txt

# Verify model file path
python -c "from pathlib import Path; print(Path('weights/best_model.pt').exists())"

Frontend can't connect to backend

# Check environment variables
cat frontend/.env

# Verify API URL is correct
# VITE_API_URL=http://localhost:8000/api/v1

# Check CORS settings (backend/app/core/config.py)

PyTorch installation error (Windows)

# Install PyTorch 2.0+ (CPU)
pip install torch>=2.0.0 --index-url https://download.pytorch.org/whl/cpu

# GPU version (CUDA 11.8)
pip install torch>=2.0.0 --index-url https://download.pytorch.org/whl/cu118

License

This project is licensed under the PolyForm Noncommercial License 1.0.0.

Key points:

  • Free for research, education, and non-commercial use
  • Modifications allowed with proper attribution
  • Not a copyleft license (your modifications don't have to use the same license)
  • Commercial use requires separate licensing agreement

See the LICENSE file for full terms.

Contact

For questions or issues, please open an issue on GitHub.


NAVTEX Recovery - AI-powered Maritime Safety Communication Restoration System

About

AI-powered restoration system for damaged NAVTEX (NAVigational TEleX) maritime safety messages.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors