export interface ExportInputBoundingBox { label: string; width: number; height: number; x: number; y: number; } export interface ExportBoundingBoxesFileV1 { version: 1; type: 'bounding-box-labels'; boundingBoxes: BoundingBoxesMap; } export interface BoundingBoxesMap { [fileName: string]: ExportInputBoundingBox[]; } export declare function parseBoundingBoxLabels(jsonFile: string): ExportBoundingBoxesFileV1; export declare function validateBoundingBoxLabelsFile(data: ExportBoundingBoxesFileV1): ExportBoundingBoxesFileV1; export declare function verifyBoundingBoxes(boundingBoxes: ExportInputBoundingBox[]): void; export type ExportStructuredLabelsFileV1 = { version: 1; type: 'structured-labels'; structuredLabels: StructuredLabelsMap; }; export type ExportLabelMapFileV1 = { version: 1; type: 'label-map-labels'; labels: LabelMap; }; export type LabelMapPerFile = { [file: string]: { [key: string]: string; }; }; export type StructuredLabelExternal = { startIndex: number; endIndex: number; label: string; labelMap?: { type: 'key-values'; labels: { [key: string]: string; }; }; }; export type ExportStructuredLabel = { startIndex: number; endIndex: number; label: string; labelMap?: { [key: string]: string; }; }; export type StructuredLabelsMap = { [fileName: string]: ExportStructuredLabel[]; }; export type LabelMap = { [fileName: string]: { [key: string]: string; } | string[]; }; export declare function parseStructuredLabelsFile(jsonFile: string): ExportStructuredLabelsFileV1; export declare function validateStructuredLabelsFile(data: ExportStructuredLabelsFileV1): ExportStructuredLabelsFileV1; export type StructuredLabelSource = 'structured_labels.labels' | 'payload.structured_labels' | 'labels from csv file' | 'structuredLabels'; export declare function parseStructuredLabelsString(json: string, source: StructuredLabelSource): ExportStructuredLabel[]; export declare function verifyStructuredLabelsString(json: string, valuesCount: number, source: StructuredLabelSource): ExportStructuredLabel[]; export declare function verifyStructuredLabelsExternal(labels: StructuredLabelExternal[], valuesCount: number, source: StructuredLabelSource): ExportStructuredLabel[]; export declare function mapExternalStructuredLabelsToInternal(labels: StructuredLabelExternal[]): ExportStructuredLabel[]; export declare function verifyStructuredLabels(labels: ExportStructuredLabel[], valuesCount: number, source: StructuredLabelSource): ExportStructuredLabel[]; /** * Parse a labelmap labels file, validating its schema and converting it to a format for internal storage. * @param jsonFile Raw JSON string * @returns LabelMapPerFile object * @throws If jsonFile is not valid JSON, or if the file does not adhere to the ExportLabelMapFileV1 schema. */ export declare function parseLabelMapFile(jsonFile: string): LabelMapPerFile; export type AllStructuredLabels = { label: string; labelMap?: { [key: string]: string; }; }; export declare function calculateAllStructuredLabelsExternal(sample: { structuredLabels: StructuredLabelExternal[]; valuesCount: number; }): AllStructuredLabels[]; /** * Check whether two structured labels are identical * @param l1 Label 1 * @param l2 Label 2 * @returns True if labels are identical */ export declare function structuredLabelsAreIdentical(l1: AllStructuredLabels, l2: AllStructuredLabels): boolean; /** * This returns a new string array of length `sample.valuesCount`, and each * value of the array contains the label of the sample at that specific index. * If you have a sample that has structured labels you can use this to easily * find what the expected label was for the sample at a certain index. * If the sample has no structured labels it'll return undefined. * @param sample The sample * @returns A string[] with labels (or undefined if no structured labels) */ export declare function calculateAllStructuredLabels(sample: { structuredLabels: ExportStructuredLabel[]; valuesCount: number; }): AllStructuredLabels[]; export type ExportAttachmentsFileV1 = { version: 1; type: 'attachments'; attachments: ExportAttachmentsMap; }; export type ExportAttachmentsMap = { [fileName: string]: { filename: string; }[]; }; export declare function parseAttachmentsFile(attachmentsFile: string): ExportAttachmentsFileV1; export declare function validateAttachmentsFile(data: ExportAttachmentsFileV1): ExportAttachmentsFileV1; export type ExportUploaderInfoFileCategory = 'training' | 'testing' | 'validation' | 'post-processing' | 'split'; export type ExportUploaderInfoFileMultiLabel = { startIndex: number; endIndex: number; label: string; labelMap?: { [key: string]: string; }; }; export type ExportUploaderInfoFileLabel = { type: 'unlabeled'; } | { type: 'label'; label: string; } | { type: 'multi-label'; labels: ExportUploaderInfoFileMultiLabel[]; } | { type: 'keyvalue-labels'; labels: { [key: string]: string; }; }; export interface ExportUploaderInfoFile { path: string; name: string | undefined; category: ExportUploaderInfoFileCategory; label: ExportUploaderInfoFileLabel; metadata: { [k: string]: string; } | undefined; boundingBoxes: ExportInputBoundingBox[] | undefined; attachments: string[] | undefined; } export interface ExportUploaderInfoFileV1 { version: 1; files: ExportUploaderInfoFile[]; } export declare const NDJSON_MARKER_PROP = "{\"__ndjson\":true,"; /** * Check if json file content has the NDJSON marker property, which indicates that the file * should be parsed as NDJSON. This is an internal approach, f.e. used by for (large) dataset export. * @param content Content of the JSON file (stringified) to check for the NDJSON marker * @param n Number of characters to check from the start of the content (default: 64) */ export declare function hasNdjsonMarkerPrefix(content: string, n?: number): boolean; /** * Parse object from NDJSON text * @param text NDJSON text * @param itemsKeys Keys of properties that are arrays of items that were exported as NDJSON lines * Expected format per line: { __key: string, __item: any } * @returns Parsed object */ export declare function parseObjectFromNdjson(text: string, itemsKeys: string[]): { [key: string]: any; }; export declare function parseUploaderInfo(jsonFile: string): ExportUploaderInfoFileV1;