seavision 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. seavision-1.0.0/.claude/CLAUDE.md +5 -0
  2. seavision-1.0.0/.github/dependabot.yml +14 -0
  3. seavision-1.0.0/.github/workflows/ci.yaml +160 -0
  4. seavision-1.0.0/.github/workflows/docs.yaml +40 -0
  5. seavision-1.0.0/.github/workflows/publish.yaml +64 -0
  6. seavision-1.0.0/.gitignore +181 -0
  7. seavision-1.0.0/.pre-commit-config.yaml +54 -0
  8. seavision-1.0.0/.sonarlint/connectedMode.json +4 -0
  9. seavision-1.0.0/.vscode/extensions.json +8 -0
  10. seavision-1.0.0/.vscode/settings.json +30 -0
  11. seavision-1.0.0/AGENTS.md +92 -0
  12. seavision-1.0.0/PKG-INFO +112 -0
  13. seavision-1.0.0/README.md +77 -0
  14. seavision-1.0.0/docs/assets/banner.png +0 -0
  15. seavision-1.0.0/docs/assets/inference-output.png +0 -0
  16. seavision-1.0.0/docs/detection-demo.md +6 -0
  17. seavision-1.0.0/docs/gen_cli_pages.py +36 -0
  18. seavision-1.0.0/docs/gen_ref_pages.py +36 -0
  19. seavision-1.0.0/docs/getting-started.md +9 -0
  20. seavision-1.0.0/docs/includes/abbreviations.md +8 -0
  21. seavision-1.0.0/docs/index.md +27 -0
  22. seavision-1.0.0/mkdocs.yml +147 -0
  23. seavision-1.0.0/notebooks/.gitkeep +0 -0
  24. seavision-1.0.0/notebooks/inference.ipynb +486 -0
  25. seavision-1.0.0/notebooks/sensorfusion.ipynb +232 -0
  26. seavision-1.0.0/pyproject.toml +130 -0
  27. seavision-1.0.0/ruff.toml +96 -0
  28. seavision-1.0.0/seavision/__init__.py +38 -0
  29. seavision-1.0.0/seavision/calibration/README.md +41 -0
  30. seavision-1.0.0/seavision/calibration/__init__.py +7 -0
  31. seavision-1.0.0/seavision/calibration/__main__.py +45 -0
  32. seavision-1.0.0/seavision/calibration/parsers.py +58 -0
  33. seavision-1.0.0/seavision/calibration/server.py +265 -0
  34. seavision-1.0.0/seavision/calibration/static/assets/SEA.AI_logo_dark_blue_RGB.png +0 -0
  35. seavision-1.0.0/seavision/calibration/static/css/base.css +161 -0
  36. seavision-1.0.0/seavision/calibration/static/css/components.css +1108 -0
  37. seavision-1.0.0/seavision/calibration/static/index.html +224 -0
  38. seavision-1.0.0/seavision/calibration/static/js/api.js +54 -0
  39. seavision-1.0.0/seavision/calibration/static/js/browser.js +128 -0
  40. seavision-1.0.0/seavision/calibration/static/js/controls.js +32 -0
  41. seavision-1.0.0/seavision/calibration/static/js/main.js +282 -0
  42. seavision-1.0.0/seavision/calibration/static/js/viewer.js +235 -0
  43. seavision-1.0.0/seavision/calibration/utils.py +243 -0
  44. seavision-1.0.0/seavision/cli/__init__.py +78 -0
  45. seavision-1.0.0/seavision/cli/calibration.py +86 -0
  46. seavision-1.0.0/seavision/cli/compose_onnx.py +75 -0
  47. seavision-1.0.0/seavision/cli/inference.py +351 -0
  48. seavision-1.0.0/seavision/cli/models.py +65 -0
  49. seavision-1.0.0/seavision/cli/utils.py +96 -0
  50. seavision-1.0.0/seavision/deployment/__init__.py +1 -0
  51. seavision-1.0.0/seavision/deployment/compose_onnx.py +173 -0
  52. seavision-1.0.0/seavision/deployment/onnx2trt.py +141 -0
  53. seavision-1.0.0/seavision/deployment/speedtest.py +111 -0
  54. seavision-1.0.0/seavision/experimental/README.md +17 -0
  55. seavision-1.0.0/seavision/experimental/__init__.py +5 -0
  56. seavision-1.0.0/seavision/experimental/false_zoom.py +89 -0
  57. seavision-1.0.0/seavision/experimental/video_embeddings.py +159 -0
  58. seavision-1.0.0/seavision/fiveone/.gitignore +1 -0
  59. seavision-1.0.0/seavision/fiveone/__init__.py +10 -0
  60. seavision-1.0.0/seavision/fiveone/composite.py +212 -0
  61. seavision-1.0.0/seavision/fiveone/inference.py +393 -0
  62. seavision-1.0.0/seavision/fiveone/representativeness.py +86 -0
  63. seavision-1.0.0/seavision/geometry/__init__.py +10 -0
  64. seavision-1.0.0/seavision/geometry/composite.py +187 -0
  65. seavision-1.0.0/seavision/geometry/distance.py +440 -0
  66. seavision-1.0.0/seavision/geometry/pinhole.py +274 -0
  67. seavision-1.0.0/seavision/geometry/transformations.py +154 -0
  68. seavision-1.0.0/seavision/geometry/utils.py +49 -0
  69. seavision-1.0.0/seavision/inference/README.md +157 -0
  70. seavision-1.0.0/seavision/inference/__init__.py +40 -0
  71. seavision-1.0.0/seavision/inference/ahoy.py +154 -0
  72. seavision-1.0.0/seavision/inference/dan.py +300 -0
  73. seavision-1.0.0/seavision/inference/holy.py +256 -0
  74. seavision-1.0.0/seavision/inference/horizon_extraction/__init__.py +11 -0
  75. seavision-1.0.0/seavision/inference/horizon_extraction/extract.py +102 -0
  76. seavision-1.0.0/seavision/inference/horizon_extraction/fit.py +229 -0
  77. seavision-1.0.0/seavision/inference/horizon_extraction/ops.py +146 -0
  78. seavision-1.0.0/seavision/inference/infer_abc.py +120 -0
  79. seavision-1.0.0/seavision/inference/infer_onnx2torch.py +239 -0
  80. seavision-1.0.0/seavision/inference/infer_tf.py +154 -0
  81. seavision-1.0.0/seavision/inference/infer_trt.py +315 -0
  82. seavision-1.0.0/seavision/inference/louisnet.py +124 -0
  83. seavision-1.0.0/seavision/inference/mimo.py +71 -0
  84. seavision-1.0.0/seavision/inference/model_abc.py +492 -0
  85. seavision-1.0.0/seavision/inference/models.py +192 -0
  86. seavision-1.0.0/seavision/inference/postprocessing.py +950 -0
  87. seavision-1.0.0/seavision/inference/preprocessing.py +351 -0
  88. seavision-1.0.0/seavision/inference/rahi.py +119 -0
  89. seavision-1.0.0/seavision/inference/results.py +993 -0
  90. seavision-1.0.0/seavision/inference/sahi.py +142 -0
  91. seavision-1.0.0/seavision/inference/seayolo.py +101 -0
  92. seavision-1.0.0/seavision/inference/slicing.py +186 -0
  93. seavision-1.0.0/seavision/inference/utils.py +112 -0
  94. seavision-1.0.0/seavision/inference/yolo.py +148 -0
  95. seavision-1.0.0/seavision/io/__init__.py +18 -0
  96. seavision-1.0.0/seavision/io/image.py +94 -0
  97. seavision-1.0.0/seavision/io/utils.py +24 -0
  98. seavision-1.0.0/seavision/io/video.py +829 -0
  99. seavision-1.0.0/seavision/sensorfusion/__init__.py +17 -0
  100. seavision-1.0.0/seavision/sensorfusion/common.py +31 -0
  101. seavision-1.0.0/seavision/sensorfusion/fusion_abc.py +179 -0
  102. seavision-1.0.0/seavision/sensorfusion/nms.py +62 -0
  103. seavision-1.0.0/seavision/sensorfusion/utils.py +17 -0
  104. seavision-1.0.0/seavision/sensorfusion/wbf.py +50 -0
  105. seavision-1.0.0/seavision/transforms/__init__.py +20 -0
  106. seavision-1.0.0/seavision/transforms/base.py +70 -0
  107. seavision-1.0.0/seavision/transforms/clip.py +61 -0
  108. seavision-1.0.0/seavision/transforms/color.py +17 -0
  109. seavision-1.0.0/seavision/transforms/compose.py +104 -0
  110. seavision-1.0.0/seavision/transforms/enhance.py +84 -0
  111. seavision-1.0.0/seavision/transforms/normalize.py +66 -0
  112. seavision-1.0.0/seavision/utils/__init__.py +1 -0
  113. seavision-1.0.0/seavision/utils/downloads.py +148 -0
  114. seavision-1.0.0/seavision/utils/general.py +138 -0
  115. seavision-1.0.0/seavision/utils/jetson.py +202 -0
  116. seavision-1.0.0/seavision/utils/onnx_utils.py +140 -0
  117. seavision-1.0.0/sonar-project.properties +23 -0
  118. seavision-1.0.0/tests/assets/legacy_sensors/offshore_v1.json +143 -0
  119. seavision-1.0.0/tests/assets/oceanus_sensors/sentry_v1.json +384 -0
  120. seavision-1.0.0/tests/assets/sensors/coastkeeper.json +201 -0
  121. seavision-1.0.0/tests/assets/sensors/invalid_json.json +1 -0
  122. seavision-1.0.0/tests/assets/sensors/invalid_no_cameras_key.json +5 -0
  123. seavision-1.0.0/tests/assets/sensors/test_camera_config.json +24 -0
  124. seavision-1.0.0/tests/calibration/test_parsers.py +53 -0
  125. seavision-1.0.0/tests/calibration/test_server.py +441 -0
  126. seavision-1.0.0/tests/calibration/test_utils.py +221 -0
  127. seavision-1.0.0/tests/cli/test_cli_compose_onnx.py +55 -0
  128. seavision-1.0.0/tests/cli/test_cli_inference.py +102 -0
  129. seavision-1.0.0/tests/cli/test_cli_models.py +71 -0
  130. seavision-1.0.0/tests/cli/test_cli_utils.py +50 -0
  131. seavision-1.0.0/tests/conftest.py +148 -0
  132. seavision-1.0.0/tests/deployment/test_compose_onnx.py +159 -0
  133. seavision-1.0.0/tests/deployment/test_speedtest.py +143 -0
  134. seavision-1.0.0/tests/geometry/test_composite.py +163 -0
  135. seavision-1.0.0/tests/geometry/test_distance.py +608 -0
  136. seavision-1.0.0/tests/geometry/test_geometry.py +167 -0
  137. seavision-1.0.0/tests/geometry/test_sensors.py +307 -0
  138. seavision-1.0.0/tests/inference/test_dan_variant_resolution.py +23 -0
  139. seavision-1.0.0/tests/inference/test_hf_login.py +29 -0
  140. seavision-1.0.0/tests/inference/test_horizon_extraction.py +371 -0
  141. seavision-1.0.0/tests/inference/test_inference.py +179 -0
  142. seavision-1.0.0/tests/inference/test_input_fmt.py +170 -0
  143. seavision-1.0.0/tests/inference/test_model_abc.py +161 -0
  144. seavision-1.0.0/tests/inference/test_postprocess.py +276 -0
  145. seavision-1.0.0/tests/inference/test_preprocess.py +67 -0
  146. seavision-1.0.0/tests/inference/test_results.py +117 -0
  147. seavision-1.0.0/tests/io/test_image.py +107 -0
  148. seavision-1.0.0/tests/io/test_video.py +270 -0
  149. seavision-1.0.0/tests/sensorfusion/conftest.py +126 -0
  150. seavision-1.0.0/tests/sensorfusion/test_sensorfusion.py +66 -0
  151. seavision-1.0.0/tests/test_load_model.py +38 -0
  152. seavision-1.0.0/tests/transforms/test_transforms.py +122 -0
  153. seavision-1.0.0/uv.lock +8559 -0
@@ -0,0 +1,5 @@
1
+ # Claude Code Project Instructions
2
+
3
+ <!-- Imports AGENTS.md, which contains agent roles, behavioral rules, and coding constraints for this project. -->
4
+
5
+ @../AGENTS.md
@@ -0,0 +1,14 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5
+
6
+ version: 2
7
+ updates:
8
+ # Enable version updates for GitHub Actions
9
+ - package-ecosystem: "github-actions"
10
+ # Workflow files stored in the default location of `.github/workflows`
11
+ # You don't need to specify `/.github/workflows` for `directory`. You can use `directory: "/"`.
12
+ directory: "/"
13
+ schedule:
14
+ interval: "weekly"
@@ -0,0 +1,160 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - develop
7
+ pull_request:
8
+ branches:
9
+ - develop
10
+
11
+ jobs:
12
+ checkout:
13
+ runs-on: ubuntu-latest
14
+ outputs:
15
+ repo-cache-key: repo-${{ github.sha }}
16
+ steps:
17
+ - name: 📥 Checkout repository
18
+ uses: actions/checkout@v6
19
+ with:
20
+ fetch-depth: 0 # Ensures we get commit history for diffing
21
+
22
+ - name: 🔄 Cache repository
23
+ uses: actions/cache@v5
24
+ with:
25
+ path: . # Cache the entire repo
26
+ key: repo-${{ github.sha }}
27
+
28
+ changed-files:
29
+ needs: checkout
30
+ runs-on: ubuntu-latest
31
+ outputs:
32
+ changed_files: ${{ steps.changed-python-files.outputs.all_changed_files }}
33
+ steps:
34
+ - name: 🔄 Restore repository from cache
35
+ uses: actions/cache@v5
36
+ with:
37
+ path: .
38
+ key: repo-${{ github.sha }}
39
+
40
+ - name: 🔍 Get changed files
41
+ id: changed-python-files
42
+ uses: tj-actions/changed-files@v47
43
+ with:
44
+ files: |
45
+ **/*.py
46
+ **/*.pyi
47
+
48
+ ruff-linter:
49
+ needs: changed-files
50
+ runs-on: ubuntu-latest
51
+ if: ${{ needs.changed-files.outputs.changed_files != '' }}
52
+ permissions:
53
+ contents: read
54
+ pull-requests: write
55
+ steps:
56
+ - name: 🔄 Restore repository from cache
57
+ uses: actions/cache@v5
58
+ with:
59
+ path: .
60
+ key: repo-${{ github.sha }}
61
+
62
+ - uses: astral-sh/ruff-action@v3
63
+ name: ✨ Lint with Ruff (only changed files)
64
+ with:
65
+ version: "latest"
66
+ src: ${{ needs.changed-files.outputs.changed_files }}
67
+ args: check --output-format=github
68
+
69
+ ruff-format:
70
+ needs: changed-files
71
+ runs-on: ubuntu-latest
72
+ if: ${{ needs.changed-files.outputs.changed_files != '' }}
73
+ permissions:
74
+ contents: read
75
+ pull-requests: write
76
+ steps:
77
+ - name: 🔄 Restore repository from cache
78
+ uses: actions/cache@v5
79
+ with:
80
+ path: .
81
+ key: repo-${{ github.sha }}
82
+
83
+ - uses: astral-sh/ruff-action@v3
84
+ name: 📝 Format with Ruff (only changed files)
85
+ with:
86
+ version: "latest"
87
+ src: ${{ needs.changed-files.outputs.changed_files }}
88
+ args: "format --diff"
89
+
90
+ pylint:
91
+ needs: changed-files
92
+ runs-on: ubuntu-latest
93
+ if: ${{ needs.changed-files.outputs.changed_files != '' }}
94
+ permissions:
95
+ contents: read
96
+ pull-requests: write
97
+ steps:
98
+ - name: 🔄 Restore repository from cache
99
+ uses: actions/cache@v5
100
+ with:
101
+ path: .
102
+ key: repo-${{ github.sha }}
103
+
104
+ - name: 🛠️ Install the latest version of uv and set the python version
105
+ uses: astral-sh/setup-uv@v7
106
+ with:
107
+ enable-cache: true
108
+ cache-dependency-glob: "uv.lock"
109
+
110
+ - name: 🦾 Install the project
111
+ run: uv sync --all-extras
112
+
113
+ - name: 🦾 Install pylint
114
+ run: uv pip install pylint
115
+
116
+ - name: 🔍 Run Pylint
117
+ run: uv run pylint ${{ needs.changed-files.outputs.changed_files }}
118
+
119
+ sonarqube:
120
+ needs:
121
+ - checkout # Needs full repo
122
+ - changed-files
123
+ - ruff-linter
124
+ - ruff-format
125
+ - pylint
126
+ runs-on: ubuntu-latest
127
+ if: ${{ needs.changed-files.outputs.changed_files != '' }}
128
+ steps:
129
+ - name: 🔄 Restore repository from cache
130
+ uses: actions/cache@v5
131
+ with:
132
+ path: .
133
+ key: repo-${{ github.sha }}
134
+
135
+ - name: 📥 Install ffmpeg
136
+ uses: AnimMouse/setup-ffmpeg@v1
137
+
138
+ - name: 🛠️ Install the latest version of uv and set the python version
139
+ uses: astral-sh/setup-uv@v7
140
+ with:
141
+ enable-cache: true
142
+ cache-dependency-glob: "uv.lock"
143
+
144
+ - name: 🦾 Install the project
145
+ run: uv sync
146
+
147
+ - name: 🧪 Run pytest with coverage
148
+ env:
149
+ HF_TOKEN: ${{ secrets.HF_TOKEN }}
150
+ WANDB_API_KEY: ${{ secrets.WANDB_API_KEY }}
151
+ run: uv run pytest --cov-report=xml
152
+
153
+ - name: 🔎 SonarQube Cloud Scan (Full Repo)
154
+ uses: SonarSource/sonarqube-scan-action@master
155
+ env:
156
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
157
+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
158
+
159
+ - name: 🧹 Minimize uv cache
160
+ run: uv cache prune --ci
@@ -0,0 +1,40 @@
1
+ name: Docs
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - develop
7
+
8
+ permissions:
9
+ contents: write
10
+
11
+ jobs:
12
+ deploy:
13
+ runs-on: ubuntu-latest
14
+ env:
15
+ DEPLOY: true
16
+ steps:
17
+ - uses: actions/checkout@v6
18
+ with:
19
+ fetch-depth: 0
20
+
21
+ - name: Configure Git Credentials
22
+ run: |
23
+ git config user.name github-actions[bot]
24
+ git config user.email 41898282+github-actions[bot]@users.noreply.github.com
25
+
26
+ - name: Install uv
27
+ uses: astral-sh/setup-uv@v7
28
+
29
+ - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
30
+ - uses: actions/cache@v5
31
+ with:
32
+ key: mkdocs-material-${{ env.cache_id }}
33
+ path: .cache
34
+ restore-keys: |
35
+ mkdocs-material-
36
+
37
+ - name: Install dependencies and deploy docs
38
+ run: |
39
+ uv sync --all-extras
40
+ uv run mkdocs gh-deploy --force
@@ -0,0 +1,64 @@
1
+ name: Publish
2
+
3
+ on:
4
+ pull_request:
5
+ branches: [develop]
6
+ paths:
7
+ # Re-run packaging checks when the workflow, packaging config,
8
+ # or package source changes.
9
+ - ".github/workflows/publish.yaml"
10
+ - "pyproject.toml"
11
+ - "seavision/**"
12
+
13
+ # Only publish when a GitHub release is published.
14
+ release:
15
+ types: [published]
16
+
17
+ permissions:
18
+ contents: read
19
+
20
+ jobs:
21
+ # Build a universal wheel (py3-none-any) and the source distribution.
22
+ # seavision is pure Python, so one wheel works on every platform / Python
23
+ # version that satisfies requires-python.
24
+ build:
25
+ runs-on: ubuntu-latest
26
+
27
+ steps:
28
+ - uses: actions/checkout@v6
29
+ with:
30
+ ref: ${{ github.event.release.tag_name || github.sha }}
31
+ # hatch-vcs needs full git history to resolve the version from tags.
32
+ fetch-depth: 0
33
+
34
+ - uses: astral-sh/setup-uv@v7
35
+
36
+ - name: Build wheel and sdist
37
+ run: uv build
38
+
39
+ - uses: actions/upload-artifact@v7
40
+ with:
41
+ name: dist
42
+ path: dist/*
43
+
44
+ # Publish only on release, after the build artifacts exist.
45
+ publish:
46
+ needs: [build]
47
+ if: ${{ github.event_name == 'release' }}
48
+ runs-on: ubuntu-latest
49
+ environment: pypi
50
+
51
+ permissions:
52
+ # Required for trusted publishing to PyPI via GitHub OIDC.
53
+ id-token: write
54
+
55
+ steps:
56
+ - uses: actions/download-artifact@v8
57
+ with:
58
+ name: dist
59
+ path: dist
60
+
61
+ - uses: astral-sh/setup-uv@v7
62
+
63
+ - name: Publish to PyPI
64
+ run: uv publish --trusted-publishing always
@@ -0,0 +1,181 @@
1
+ # vscode
2
+ .vscode/*
3
+ !.vscode/settings.json
4
+ !.vscode/extensions.json
5
+ !.vscode/launch.json
6
+
7
+ # Models
8
+ models/
9
+ *.onnx
10
+ *.engine
11
+ *.pt
12
+
13
+ # CSV files
14
+ *.csv
15
+
16
+ # MacOS
17
+ .DS_Store
18
+
19
+ # Byte-compiled / optimized / DLL files
20
+ __pycache__/
21
+ *.py[cod]
22
+ *$py.class
23
+
24
+ # C extensions
25
+ *.so
26
+
27
+ # Distribution / packaging
28
+ .Python
29
+ build/
30
+ develop-eggs/
31
+ dist/
32
+ downloads/
33
+ eggs/
34
+ .eggs/
35
+ lib/
36
+ lib64/
37
+ parts/
38
+ sdist/
39
+ var/
40
+ wheels/
41
+ share/python-wheels/
42
+ *.egg-info/
43
+ .installed.cfg
44
+ *.egg
45
+ MANIFEST
46
+
47
+ # Ruff
48
+ .ruff_cache/
49
+
50
+ # PyInstaller
51
+ # Usually these files are written by a python script from a template
52
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
53
+ *.manifest
54
+ *.spec
55
+
56
+ # Installer logs
57
+ pip-log.txt
58
+ pip-delete-this-directory.txt
59
+
60
+ # Unit test / coverage reports
61
+ htmlcov/
62
+ .tox/
63
+ .nox/
64
+ .coverage
65
+ .coverage.*
66
+ .cache
67
+ nosetests.xml
68
+ coverage.xml
69
+ *.cover
70
+ *.py,cover
71
+ .hypothesis/
72
+ .pytest_cache/
73
+ cover/
74
+
75
+ # Translations
76
+ *.mo
77
+ *.pot
78
+
79
+ # Django stuff:
80
+ *.log
81
+ local_settings.py
82
+ db.sqlite3
83
+ db.sqlite3-journal
84
+
85
+ # Flask stuff:
86
+ instance/
87
+ .webassets-cache
88
+
89
+ # Scrapy stuff:
90
+ .scrapy
91
+
92
+ # Sphinx documentation
93
+ docs/_build/
94
+
95
+ # PyBuilder
96
+ .pybuilder/
97
+ target/
98
+
99
+ # Jupyter Notebook
100
+ .ipynb_checkpoints
101
+
102
+ # IPython
103
+ profile_default/
104
+ ipython_config.py
105
+
106
+ # pyenv
107
+ # For a library or package, you might want to ignore these files since the code is
108
+ # intended to run in multiple environments; otherwise, check them in:
109
+ # .python-version
110
+
111
+ # pipenv
112
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
113
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
114
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
115
+ # install all needed dependencies.
116
+ #Pipfile.lock
117
+
118
+ # poetry
119
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
120
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
121
+ # commonly ignored for libraries.
122
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
123
+ #poetry.lock
124
+
125
+ # pdm
126
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
127
+ #pdm.lock
128
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
129
+ # in version control.
130
+ # https://pdm.fming.dev/#use-with-ide
131
+ .pdm.toml
132
+
133
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
134
+ __pypackages__/
135
+
136
+ # Celery stuff
137
+ celerybeat-schedule
138
+ celerybeat.pid
139
+
140
+ # SageMath parsed files
141
+ *.sage.py
142
+
143
+ # Environments
144
+ .env
145
+ .venv
146
+ env/
147
+ venv/
148
+ ENV/
149
+ env.bak/
150
+ venv.bak/
151
+
152
+ # Spyder project settings
153
+ .spyderproject
154
+ .spyproject
155
+
156
+ # Rope project settings
157
+ .ropeproject
158
+
159
+ # mkdocs documentation
160
+ /site
161
+
162
+ # mypy
163
+ .mypy_cache/
164
+ .dmypy.json
165
+ dmypy.json
166
+
167
+ # Pyre type checker
168
+ .pyre/
169
+
170
+ # pytype static type analyzer
171
+ .pytype/
172
+
173
+ # Cython debug symbols
174
+ cython_debug/
175
+
176
+ # PyCharm
177
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
178
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
179
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
180
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
181
+ #.idea/
@@ -0,0 +1,54 @@
1
+ # See https://pre-commit.com for more information
2
+ # See https://pre-commit.com/hooks.html for more hooks
3
+ repos:
4
+ - repo: https://gitlab.com/vojko.pribudic.foss/pre-commit-update
5
+ rev: v0.9.0
6
+ hooks:
7
+ - id: pre-commit-update
8
+
9
+ - repo: https://github.com/pre-commit/pre-commit-hooks
10
+ rev: v6.0.0
11
+ hooks:
12
+ - id: trailing-whitespace
13
+ - id: end-of-file-fixer
14
+ - id: check-yaml
15
+ exclude: mkdocs.yml
16
+ - id: check-added-large-files
17
+ args: ["--maxkb=1500"]
18
+ - id: check-json
19
+ - id: pretty-format-json
20
+ args: [--autofix, --no-sort-keys]
21
+ exclude: .*\.ipynb$
22
+ - id: check-case-conflict
23
+ - id: name-tests-test
24
+ args: [--pytest-test-first]
25
+
26
+ - repo: https://github.com/gitleaks/gitleaks
27
+ rev: v8.30.1
28
+ hooks:
29
+ - id: gitleaks
30
+
31
+ - repo: https://github.com/astral-sh/ruff-pre-commit
32
+ # Ruff version.
33
+ rev: v0.15.9
34
+ hooks:
35
+ # Run the linter.
36
+ - id: ruff
37
+ args: [--fix]
38
+ - id: ruff-format
39
+ exclude: .*\.ipynb$
40
+
41
+ - repo: https://github.com/pre-commit/mirrors-clang-format
42
+ rev: v22.1.2
43
+ hooks:
44
+ - id: clang-format
45
+ types_or: [c, c++, cuda]
46
+
47
+ # vscode does not use python environment, so run tests manually
48
+ # - repo: local
49
+ # hooks:
50
+ # - id: pytest
51
+ # name: run unit tests
52
+ # entry: pytest
53
+ # language: system
54
+ # pass_filenames: false
@@ -0,0 +1,4 @@
1
+ {
2
+ "sonarCloudOrganization": "sea-ai",
3
+ "projectKey": "SEA-AI_seavision"
4
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "recommendations": [
3
+ "ms-python.python",
4
+ "charliermarsh.ruff",
5
+ "ms-python.pylint"
6
+ ],
7
+ "unwantedRecommendations": []
8
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "[python]": {
3
+ "editor.defaultFormatter": "charliermarsh.ruff",
4
+ "editor.formatOnSave": true,
5
+ "editor.codeActionsOnSave": {
6
+ "source.organizeImports": "explicit",
7
+ "source.fixAll.ruff": "explicit"
8
+ }
9
+ },
10
+ "sonarlint.connectedMode.project": {
11
+ "connectionId": "sea-ai",
12
+ "projectKey": "SEA-AI_seavision"
13
+ },
14
+ "python.testing.pytestArgs": [
15
+ "tests"
16
+ ],
17
+ "python.testing.unittestEnabled": false,
18
+ "python.testing.pytestEnabled": true,
19
+ "pylint.ignorePatterns": [
20
+ "*test*.py"
21
+ ],
22
+ "files.exclude": {
23
+ "**/.mypy_cache": true,
24
+ "**/.pytest_cache": true,
25
+ "**/.ruff_cache": true
26
+ },
27
+ "emojisense.languages": {
28
+ "python": true
29
+ }
30
+ }
@@ -0,0 +1,92 @@
1
+ # AGENTS.md
2
+
3
+ This file guides AI coding assistants (e.g. Claude Code, Cursor) when working in this repository.
4
+
5
+ ## Commands
6
+
7
+ ```bash
8
+ # Install dependencies (use uv, not pip)
9
+ uv sync # main + dev dependencies
10
+ uv sync --all-extras # include optional extras (e.g. fiftyone)
11
+
12
+ # Linting and formatting
13
+ uvx ruff check --fix # lint and auto-fix
14
+ uvx ruff format # format code
15
+
16
+ # Testing
17
+ uv run pytest # run all tests
18
+ uv run pytest tests/path/to/test_file.py # run a single test file
19
+ uv run pytest -k "test_name" # run tests matching a pattern
20
+ uv run pytest --cov # run with coverage (default in pytest.ini)
21
+
22
+ # Documentation
23
+ uvx mkdocs serve # serve docs locally
24
+
25
+ # Pre-commit hooks
26
+ uvx pre-commit install # install hooks
27
+ uvx pre-commit run --all-files # run all hooks manually
28
+
29
+ # CLI (after install)
30
+ seavision models list
31
+ seavision inference <path>
32
+ seavision calibration
33
+ ```
34
+
35
+ ## Architecture
36
+
37
+ SeaVision is a Python computer vision library for maritime/naval applications (ship detection, thermal imaging, horizon detection, sensor fusion). It supports Python 3.9–3.12.
38
+
39
+ ### Module Overview
40
+
41
+ - **`inference/`** — Core module. Model loading, preprocessing, postprocessing, and inference pipelines. Contains model implementations: AHOY (multi-modal), DAN (dual YOLO), HOLY, RAHI (region-based), SAHI (sliced), LouisNet, SeaYOLO. Supports TensorRT, ONNX2Torch, and TensorFlow backends.
42
+ - **`io/`** — VideoReader/VideoWriter with multi-threaded queue-based reading. Handles webcam, RTSP, local files. `VideoFormatRegistry` allows extensible format handlers.
43
+ - **`geometry/`** — Immutable pinhole `Camera` (intrinsics/pose) and `CameraGeometry` helpers in `pinhole.py`. Composite image/video utilities for multi-sensor layouts. Distance / JSON config types live in `distance.py`.
44
+ - **`calibration/`** — FastAPI-based web UI for interactive camera extrinsic tuning (pitch/yaw/roll).
45
+ - **`transforms/`** — Image/video processing: normalization, enhancement, color conversion.
46
+ - **`sensorfusion/`** — Multi-sensor fusion: NMS and Weighted Boxes Fusion (WBF, the primary algorithm).
47
+ - **`deployment/`** — Model format conversion: ONNX → TRT composition utilities.
48
+ - **`cli/`** — Click-based CLI entry point (`seavision` command).
49
+ - **`utils/`** — Logging, HuggingFace Hub downloads, ONNX utilities.
50
+ - **`fiveone/`** — Optional FiftyOne dataset integration (excluded from coverage).
51
+ - **`experimental/`** — Zoom and video embedding experiments.
52
+
53
+ ### Key Patterns
54
+
55
+ **Inference pipeline:**
56
+ ```python
57
+ output = postprocess(model.forward(preprocess(inputs)))
58
+ ```
59
+
60
+ **Abstract base classes:** `Model` (all inference models), `Infer` (inference engine backends), `SensorFusion` (fusion algorithms).
61
+
62
+ **Factory pattern:** `ModelFactory` loads models from HuggingFace Hub, local ONNX files, TensorRT engines, or W&B. Enum-based model variants select specific configurations.
63
+
64
+ **Results datamodel:** Immutable dataclasses (`Results`, `Object`, `BBox`, `Horizon`, `Line`) with coordinate helpers (normalized ↔ absolute pixels), FiftyOne export, and drawing/visualization support.
65
+
66
+ **Public API entry point:**
67
+ ```python
68
+ import seavision as sv
69
+ model = sv.load_model("ahoyv2n-MIX-b1")
70
+ results = model(image)
71
+ results.draw(image).show()
72
+ ```
73
+
74
+ ### Testing
75
+
76
+ Tests mirror the source structure. Fixtures in `tests/conftest.py` provide sample `Results` with boats, ships, and horizon data. Test assets in `tests/assets/` include sensor configs (legacy/oceanus/standard). Some tests fetch images from GitHub; set a local asset folder env var for offline testing.
77
+
78
+ - **`ffmpeg`** must be installed on the system (used by `av` / `ffmpeg-python`); without it, video-related tests and code paths can fail.
79
+ - Some tests download models from **Hugging Face** or **Weights & Biases** and need **`HF_TOKEN`** and **`WANDB_API_KEY`**; those tests fail without the secrets, while the rest of the suite can still pass.
80
+
81
+ Coverage excludes `fiveone/`, TensorRT code, and the HOLY model.
82
+
83
+ ### Code Style
84
+
85
+ - Ruff enforces Google-style docstrings, 88-char line length, and 14 rule categories (D, E, F, W, ANN, B, TC, PTH, NPY, TID, SIM, I, PL, ERA).
86
+ - Single-letter variable names are allowed for matrix conventions: `K` (camera intrinsics), `R` (rotation), `H` (homography), `B` (batch), `C` (channels), `W` (width), `G` (grayscale).
87
+ - Heavy dependencies (torch, cv2, onnx) use lazy imports (import-outside-toplevel is allowed); type-only imports go in `TYPE_CHECKING` blocks.
88
+ - Max 10 args/attributes per function or class.
89
+
90
+ ### CI
91
+
92
+ The CI pipeline (`.github/workflows/ci.yaml`) detects changed files and runs Ruff, Pylint, SonarQube, and pytest only on affected code. PRs target the `develop` branch.