Skip to content

Commit 93c061a

Browse files
authored
Swap to kitware:gpu-algorithms-web tag for base Worker Branch (#1487)
* utilizing the viame:gpu-algorithms-web tag for smaller image sizes * fix tiled image downloading, everything downloads * read only mode disabled button until settings are validated after saving * add support for execTime for desktop CSV files
1 parent 7643155 commit 93c061a

File tree

6 files changed

+35
-10
lines changed

6 files changed

+35
-10
lines changed

client/platform/desktop/backend/native/common.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ async function _ingestFilePath(
586586
await fs.copy(path, newPath);
587587
// Attempt to process the file
588588
let annotations = dive.makeEmptyAnnotationFile();
589-
const meta: DatasetMetaMutable & { fps?: number } = {};
589+
const meta: DatasetMetaMutable & { fps?: number, execTime?: number } = {};
590590
let metadataConfig = false;
591591
if (JsonFileName.test(path)) {
592592
const jsonObject = await _loadAsJson(path);
@@ -610,6 +610,7 @@ async function _ingestFilePath(
610610
annotations.tracks = data[0].tracks;
611611
annotations.groups = data[0].groups;
612612
meta.fps = data[0].fps;
613+
meta.execTime = data[0].execTime;
613614
[, warnings] = data;
614615
} else if (YAMLFileName.test(path)) {
615616
annotations = await kpf.parse([path]);

client/platform/desktop/backend/serializers/viame.ts

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const AttrRegex = /^\(atr\) (.*?)\s(.+)/g;
2828
const TrackAttrRegex = /^\(trk-atr\) (.*?)\s(.+)/g;
2929
const PolyRegex = /^(\(poly\)) ((?:-?[0-9]+\.*-?[0-9]*\s*)+)/g;
3030
const FpsRegex = /fps:\s*(\d+(\.\d+)?)/ig;
31+
const ExecTimeRegEx = /exec_time:\s*(\d+(\.\d+)?)/ig;
3132
const AtrToken = '(atr)';
3233
const TrackAtrToken = '(trk-atr)';
3334
const PolyToken = '(poly)';
@@ -37,6 +38,7 @@ export interface AnnotationFileData {
3738
tracks: MultiTrackRecord;
3839
groups: MultiGroupRecord;
3940
fps?: number;
41+
execTime?: number;
4042
}
4143

4244
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/matchAll
@@ -95,7 +97,13 @@ function parseCommentRow(row: string[]) {
9597
if (matches !== null && matches.length >= 2) {
9698
fps = Number.parseFloat(matches[1]);
9799
}
98-
return { fps };
100+
let execTime: undefined | number;
101+
const execMatches = getCaptureGroups(ExecTimeRegEx, fullrow);
102+
if (execMatches !== null && execMatches.length >= 2) {
103+
execTime = Number.parseFloat(execMatches[1]);
104+
}
105+
106+
return { fps, execTime };
99107
}
100108

101109
function _deduceType(value: string): boolean | number | string {
@@ -263,6 +271,7 @@ async function parse(input: Readable, imageMap?: Map<string, number>): Promise<[
263271
relaxColumnCount: true,
264272
});
265273
let fps: number | undefined;
274+
let execTime: number | undefined;
266275
const dataMap = new Map<number, TrackData>();
267276
const missingImages: string[] = [];
268277
const foundImages: {image: string; frame: number; csvFrame: number}[] = [];
@@ -377,7 +386,9 @@ async function parse(input: Readable, imageMap?: Map<string, number>): Promise<[
377386
if (error !== undefined) {
378387
reject(error);
379388
}
380-
resolve([{ tracks, groups: {}, fps }, warnings]);
389+
resolve([{
390+
tracks, groups: {}, fps, execTime,
391+
}, warnings]);
381392
});
382393
parser.on('readable', () => {
383394
let record: string[];
@@ -461,7 +472,11 @@ async function parse(input: Readable, imageMap?: Map<string, number>): Promise<[
461472
}
462473
if (err.toString().includes('comment row')) {
463474
// parse comment row
464-
fps = fps || parseCommentRow(record).fps;
475+
const parsedComment = parseCommentRow(record);
476+
fps = fps || parsedComment.fps;
477+
if (parsedComment.execTime) {
478+
execTime = parsedComment.execTime;
479+
}
465480
} else if (!err.toString().includes('malformed row')) {
466481
// Allow malformed row errors
467482
error = err;
@@ -495,12 +510,16 @@ async function writeHeader(writer: Writable, meta: JsonMeta) {
495510
'Confidence Pairs or Attributes',
496511
]);
497512
if (meta.fps) {
498-
writer.write([
513+
const metadataRow = [
499514
'# metadata',
500515
`fps: ${meta.fps}`,
501516
`exported_by: ${JSON.stringify('dive:typescript')}`,
502517
`exported_time: ${JSON.stringify((new Date()).toLocaleString())}`,
503-
]);
518+
];
519+
if (meta.execTime) {
520+
metadataRow.push(`exec_time: ${meta.execTime}`);
521+
}
522+
writer.write(metadataRow);
504523
}
505524
}
506525

client/platform/desktop/constants.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ export interface JsonMeta extends DatasetMetaMutable {
122122

123123
// Stereo or multi-camera datasets with uniform type (all images, all video)
124124
subType: SubType;
125+
126+
// execTime is athe execution time for desktop runs
127+
execTime?: number
125128
}
126129

127130
export type DesktopMetadata = DatasetMeta & JsonMeta;

client/platform/desktop/frontend/components/Settings.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ export default defineComponent({
6161
set(localSettings.value, name, result.filePaths[0]);
6262
}
6363
}
64-
6564
async function save() {
6665
if (localSettings.value !== null) {
6766
settingsAreValid.value = false;
@@ -158,6 +157,7 @@ export default defineComponent({
158157
<v-col>
159158
<v-switch
160159
v-model="localSettings.readonlyMode"
160+
:disabled="!settingsAreValid"
161161
color="primary"
162162
:label="'Read only mode'"
163163
hide-details
@@ -170,7 +170,7 @@ export default defineComponent({
170170
<v-card-text>
171171
<v-btn
172172
color="primary"
173-
:disabled="pendingChanges"
173+
:disabled="pendingChanges || !settingsAreValid"
174174
@click="save"
175175
>
176176
<v-icon class="mr-2">

docker/girder_worker.Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
# ====================
55
# == FFMPEG FETCHER ==
66
# ====================
7-
FROM python:3.8-bookworm as ffmpeg-builder
7+
FROM python:3.8-bookworm AS ffmpeg-builder
88
RUN wget -O ffmpeg.tar.xz https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz
99
RUN mkdir /tmp/ffextracted
1010
RUN tar -xvf ffmpeg.tar.xz -C /tmp/ffextracted --strip-components 1
1111

1212
# =================
1313
# == DIST WORKER ==
1414
# =================
15-
FROM kitware/viame:gpu-algorithms-latest as worker
15+
FROM kitware/viame:gpu-algorithms-web AS worker
1616
# VIAME install at /opt/noaa/viame/
1717
# VIAME pipelines at /opt/noaa/viame/configs/pipelines/
1818

server/dive_server/crud_dataset.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,8 @@ def makeAnnotationAndMedia(dsFolder: types.GirderModel):
275275
mediaRegex = constants.imageRegex
276276
elif source_type == constants.VideoType:
277277
mediaRegex = constants.videoRegex
278+
elif source_type == constants.LargeImageType:
279+
mediaRegex = constants.largeImageRegEx
278280
return gen, mediaFolder, mediaRegex
279281

280282
failed_datasets = []

0 commit comments

Comments
 (0)