Skip to content

Commit 0933afb

Browse files
committed
2 parents 29a268b + 08ac6ba commit 0933afb

File tree

2 files changed

+61
-14
lines changed

2 files changed

+61
-14
lines changed

.github/workflows/build-docs.yaml

+32-11
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,22 @@ on:
99
paths-ignore:
1010
- ".github/**" # Ignore changes towards the .github directory
1111

12+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
# Allow one concurrent deployment
19+
concurrency:
20+
group: "pages"
21+
cancel-in-progress: true
22+
1223
jobs:
1324
build_docs:
25+
environment:
26+
name: github-pages
27+
url: ${{ steps.deployment.outputs.page_url }}
1428
runs-on: self-hosted
1529
steps:
1630
- name: Checkout repository
@@ -34,25 +48,32 @@ jobs:
3448
make html
3549
cd ..
3650
37-
- name: Commit documentation changes
51+
- name: Clean up repo directory
3852
run: |
3953
mkdir -p /tmp/docs_build
4054
cp -r docs/build/html/* /tmp/docs_build
4155
rm -rf ./*
42-
git fetch && git pull
43-
git checkout gh-pages
56+
# git fetch && git pull
57+
# git checkout gh-pages
4458
cp -r /tmp/docs_build/* ./
4559
rm -rf /tmp/docs_build
4660
touch .nojekyll
47-
git config --local user.email "action@github.com"
48-
git config --local user.name "GitHub Action"
49-
git add .
50-
git commit -m "Update documentation" -a || true
61+
# git config --local user.email "action@github.com"
62+
# git config --local user.name "GitHub Action"
63+
# git add .
64+
# git commit -m "Update documentation" -a || true
5165
# The above command will fail if no changes were present, so we ignore
5266
# the return code.
5367
54-
- name: Push changes
55-
uses: ad-m/github-push-action@master
68+
- name: Setup Pages
69+
uses: actions/configure-pages@v2
70+
71+
- name: Upload artifact
72+
uses: actions/upload-pages-artifact@v1
5673
with:
57-
branch: gh-pages
58-
github_token: ${{ secrets.GITHUB_TOKEN }}
74+
# Upload entire repository
75+
path: '.'
76+
77+
- name: Deploy to GitHub Pages
78+
id: deployment
79+
uses: actions/deploy-pages@v1

geti_sdk/deployment/deployment.py

+29-3
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def __attrs_post_init__(self):
5151
self._is_single_task: bool = len(self.project.get_trainable_tasks()) == 1
5252
self._are_models_loaded: bool = False
5353
self._inference_converters: Dict[str, Any] = {}
54+
self._alternate_inference_converters: Dict[str, Any] = {}
5455
self._empty_labels: Dict[str, Label] = {}
5556

5657
@property
@@ -131,6 +132,7 @@ def load_inference_models(self, device: str = "CPU"):
131132
"""
132133
try:
133134
from ote_sdk.usecases.exportable_code.prediction_to_annotation_converter import (
135+
DetectionBoxToAnnotationConverter,
134136
IPredictionToAnnotationConverter,
135137
create_converter,
136138
)
@@ -159,6 +161,16 @@ def load_inference_models(self, device: str = "CPU"):
159161
converter_type=task.type.to_ote_domain(), labels=model.ote_label_schema
160162
)
161163
inference_converters.update({task.title: inference_converter})
164+
165+
# This is a workaround for a backwards incompatible change in later ote
166+
# versions
167+
if task.type.is_detection:
168+
alternate_inference_converter = DetectionBoxToAnnotationConverter(
169+
labels=model.ote_label_schema
170+
)
171+
self._alternate_inference_converters.update(
172+
{task.title: alternate_inference_converter}
173+
)
162174
empty_label = next((label for label in task.labels if label.is_empty), None)
163175
empty_labels.update({task.title: empty_label})
164176

@@ -274,9 +286,23 @@ def _infer_task(self, image: np.ndarray, task: Task) -> Prediction:
274286
height: int = image.shape[0]
275287

276288
if len(postprocessing_results) != 0:
277-
annotation_scene_entity = converter.convert_to_annotation(
278-
predictions=postprocessing_results, metadata=metadata
279-
)
289+
# The try/except is a workaround to handle different detection inference
290+
# results by different ote sdk versions
291+
try:
292+
annotation_scene_entity = converter.convert_to_annotation(
293+
predictions=postprocessing_results, metadata=metadata
294+
)
295+
except TypeError as error:
296+
if task.type.is_detection:
297+
converter = self._alternate_inference_converters[task.title]
298+
annotation_scene_entity = converter.convert_to_annotation(
299+
predictions=postprocessing_results, metadata=metadata
300+
)
301+
# Make sure next time we get it right in one shot
302+
self._inference_converters.update({task.title: converter})
303+
else:
304+
raise error
305+
280306
prediction = Prediction.from_ote(
281307
annotation_scene_entity, image_width=width, image_height=height
282308
)

0 commit comments

Comments
 (0)