Skip to content

Commit

Permalink
[Job Launcher] Dataset and ground truth path validation and hint (#2525)
Browse files Browse the repository at this point in the history
* Show a better message for ground truth errors

* Add labels to all path inputs
  • Loading branch information
flopez7 authored Sep 23, 2024
1 parent aa00838 commit 3d97f21
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,18 @@ export const CvatJobRequestForm = () => {
}
error={touched.dataPath && Boolean(errors.dataPath)}
helperText={errors.dataPath}
InputProps={{
endAdornment: (
<InputAdornment position="end">
<Tooltip title="This field should contain the relative path to the data, excluding protocol symbols like '://'. For example, if the full URL is 'https://bucket.com/bucket_name/data', the input should only include 'data'.">
<HelpOutlineIcon
color="secondary"
sx={{ cursor: 'pointer' }}
/>
</Tooltip>
</InputAdornment>
),
}}
/>
</FormControl>
</Grid>
Expand Down Expand Up @@ -609,16 +621,36 @@ export const CvatJobRequestForm = () => {
}
error={touched.bpPath && Boolean(errors.bpPath)}
helperText={errors.bpPath}
InputProps={{
endAdornment: (
<InputAdornment position="end">
<Tooltip title="This field should contain the relative path to the data, excluding protocol symbols like '://'. For example, if the full URL is 'https://bucket.com/annotations/points_15.json', the input should only include 'annotations/points_15.json'.">
<HelpOutlineIcon
color="secondary"
sx={{ cursor: 'pointer' }}
/>
</Tooltip>
</InputAdornment>
),
}}
/>
</FormControl>
</Grid>
</Grid>
)}
<Grid item container xs={12} spacing={2}>
<Grid item xs={12}>
<Typography variant="body2" fontWeight={700}>
Ground truth
</Typography>
<Box display="flex">
<Typography variant="body2" fontWeight={700}>
Ground truth
</Typography>
<Tooltip title="Ground truth data serves as the reference or gold standard for your annotations, representing the correct data against which annotations are compared for accuracy and quality assessment.">
<HelpOutlineIcon
color="secondary"
sx={{ cursor: 'pointer', ml: 1 }}
/>
</Tooltip>
</Box>
</Grid>
<Grid item xs={12} sm={12} md={6}>
<FormControl variant="outlined" fullWidth>
Expand Down Expand Up @@ -701,7 +733,7 @@ export const CvatJobRequestForm = () => {
InputProps={{
endAdornment: (
<InputAdornment position="end">
<Tooltip title="This field should contain a URL or link to the ground truth data. Ground truth data serves as the reference or gold standard for your annotations. It represents the correct or desired data, against which the annotations are compared for accuracy and quality assessment.">
<Tooltip title="This field should contain the relative path to the data, excluding protocol symbols like '://'. For example, if the full URL is 'https://bucket.com/annotations/gt_name.json', the input should only include 'annotations/gt_name.json'.">
<HelpOutlineIcon
color="secondary"
sx={{ cursor: 'pointer' }}
Expand Down
20 changes: 19 additions & 1 deletion packages/apps/job-launcher/server/src/modules/job/job.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ export class JobService {
const gt = await this.storageService.download(
`${urls.gtUrl.protocol}//${urls.gtUrl.host}${urls.gtUrl.pathname}`,
);
if (!gt || gt.length === 0)
if (!gt || !gt.images || gt.images.length === 0)
throw new ControlledError(
ErrorJob.GroundThuthValidationFailed,
HttpStatus.BAD_REQUEST,
Expand Down Expand Up @@ -574,7 +574,18 @@ export class JobService {
const gt = await this.storageService.download(
`${urls.gtUrl.protocol}//${urls.gtUrl.host}${urls.gtUrl.pathname}`,
);
if (!gt || !gt.images || gt.images.length === 0)
throw new ControlledError(
ErrorJob.GroundThuthValidationFailed,
HttpStatus.BAD_REQUEST,
);

const data = await listObjectsInBucket(urls.dataUrl);
if (!data || data.length === 0 || !data[0])
throw new ControlledError(
ErrorJob.DatasetValidationFailed,
HttpStatus.BAD_REQUEST,
);

await this.checkImageConsistency(gt.images, data);

Expand Down Expand Up @@ -880,6 +891,13 @@ export class JobService {
const data = await this.storageService.download(dataUrl.href);
const gt = await this.storageService.download(gtUrl.href);

if (!gt || !gt.images || gt.images.length === 0) {
throw new ControlledError(
ErrorJob.GroundThuthValidationFailed,
HttpStatus.BAD_REQUEST,
);
}

let gtEntries = 0;

gt.images.forEach((gtImage: CvatImageData) => {
Expand Down

0 comments on commit 3d97f21

Please sign in to comment.