Skip to content

Instantly share code, notes, and snippets.

@lifeart
Last active April 28, 2023 14:38
Show Gist options
  • Save lifeart/b79a1fb1406c06ea863acc9d4429fbc8 to your computer and use it in GitHub Desktop.
Save lifeart/b79a1fb1406c06ea863acc9d4429fbc8 to your computer and use it in GitHub Desktop.
Superannotate types
type JsonData = {
meta: Meta;
parameters: Parameter[];
}[];
interface Meta {
type: string; // The dictionary is a Bounding Box.
classId: number; // Class ID (one of the class IDs in “classes.json”). If the instance has an undefined class, the value should be -1 (classId": -1)
className?: string; // Class name. If the instance has an undefined class, the key should not be in the JSON.
pointLabels: { [key: string]: string }; // The keys are from “0” to “7” for the 8 vertices of the Bounding Box.
createdBy?: User; // Information about the user who created the Bounding Box.
createdAt: string; // The date and time when the instance was created.
updatedBy?: User; // Information about the user who updated the Bounding Box.
updatedAt: string; // The date and time when the Bounding Box was updated.
start: number; // The time that marks the beginning of a Bounding Box. The timestamp is in microseconds.
end: number; // The time that marks the end of a Bounding Box. The timestamp is in microseconds.
creationType: string; // If it’s Manual, then the comment was created manually. If it’s Preannotation, then the instance was imported with Python SDK.
}
interface User {
email: string; // The email address of the user who created or updated the Bounding Box.
role: string; // The role of the user who created or updated the Bounding Box.
}
interface Parameter {
start: number; // The time that marks the beginning of a Bounding Box. The timestamp is in microseconds.
end: number; // The time that marks the end of a Bounding Box. The timestamp is in microseconds.
timestamps: Timestamp[]; // Shows information about a Bounding Box at specific timestamps (start, end, edit).
}
interface Timestamp {
points: Points; // Points of the Bounding Box in this location on the timeline. The list of floats is: "x1, y1" for the left upper corner, and "x2, y2" for the right lower corner.
timestamp: number; // Timestamp that marks the change of the Bounding Box. The timestamp in microseconds.
attributes: Attribute[]; // List of attributes for the Bounding Box, in this location on a timeline.
}
interface Points {
x1: number;
y1: number;
x2: number;
y2: number;
}
interface Attribute {
id: number; // Attribute ID (must be in “classes.json”)
groupId: number; // Group ID (must be in “classes.json”)
name: string; // Attribute name
groupName: string; // Attributes group name
}
type CommentData = {
meta: {
type: string;
resolved: boolean;
start: number;
end: number;
createdBy: {
email: string;
role: string;
};
createdAt: string;
updatedBy: {
email: string;
role: string;
};
updatedAt: string;
correspondence: {
text: string;
email: string;
role: string;
createdAt: string;
}[];
};
parameters: {
start: number;
end: number;
timestamps: {
timestamp: number;
points: {
x1: number;
x2: number;
y1: number;
y2: number;
};
}[];
}[];
};
type EventData = {
meta: {
type: string;
classId: number;
className?: string;
createdBy: {
email: string;
role: string;
};
createdAt: string;
updatedBy: {
email: string;
role: string;
};
updatedAt: string;
start: number;
end: number;
creationType?: string;
};
parameters: {
start: number;
end: number;
timestamps: {
timestamp: number;
attributes: {
id: number;
groupId: number;
name: string;
groupName: string;
}[];
}[];
}[];
};
type Events = EventData[];
interface Meta {
type: string;
classId: number;
className?: string;
createdBy?: User;
createdAt: string;
updatedBy?: User;
updatedAt: string;
start: number;
end: number;
creationType: string;
}
interface User {
email: string;
role: string;
}
interface Attribute {
id: number;
groupId: number;
name: string;
groupName: string;
}
interface Timestamp {
timestamp: number;
attributes: Attribute[];
}
interface Parameter {
start: number;
end: number;
timestamps: Timestamp[];
}
interface Data<T extends Parameter> {
meta: Meta;
parameters: T[];
}
type JsonData = Data<Parameter>[];
type CommentData = Data<{
start: number;
end: number;
timestamps: {
timestamp: number;
points: Points;
}[];
}>;
type EventData = Data<{
start: number;
end: number;
timestamps: {
timestamp: number;
attributes: Attribute[];
}[];
}>;
type PointData = Data<{
start: number;
end: number;
timestamps: {
x: number;
y: number;
timestamp: number;
attributes: Attribute[];
}[];
}>;
type PolylineData = Data<{
start: number;
end: number;
timestamps: {
points: number[];
timestamp: number;
attributes: Attribute[];
}[];
}>;
type TagData = {
meta: {
type: string;
classId: number;
creationType: string;
className: string;
createdBy: {
email: string;
role: string;
};
createdAt: string;
updatedBy: {
email: string;
role: string;
};
updatedAt: string;
attributes: Attribute[];
probability?: number;
};
};
type PointData = {
meta: {
type: string;
classId?: number;
className?: string;
createdBy?: {
email: string;
role: string;
};
createdAt?: string;
updatedBy?: {
email: string;
role: string;
};
updatedAt?: string;
start: number;
end: number;
creationType: string;
};
parameters: {
start: number;
end: number;
timestamps: {
x: number;
y: number;
timestamp: number;
attributes: {
id?: number;
groupId?: number;
name: string;
groupName: string;
}[];
}[];
}[];
};
type JsonData = {
meta: Meta;
parameters: Parameter[];
}[];
interface Meta {
type: string; // The dictionary is a Polygon.
classId: number; // Class ID (one of the class IDs in “classes.json”). If the instance has an undefined class, the value should be -1 (classId": -1)
className?: string; // Class name. If the instance has an undefined class, the key should not be in the JSON.
createdBy?: User; // Information about the user who created the Polygon.
createdAt: string; // The date and time when the instance was created.
updatedBy?: User; // Information about the user who updated the Polygon.
updatedAt: string; // The date and time when the Polygon was updated.
start: number; // The time that marks the beginning of a Polygon. The timestamp is in microseconds.
end: number; // The time that marks the end of a Polygon. The timestamp is in microseconds.
creationType: string; // If it’s Manual, then the comment was created manually. If it’s Preannotation, then the instance was imported with Python SDK.
}
interface User {
email: string; // The email address of the user who created or updated the Polygon.
role: string; // The role of the user who created or updated the Polygon.
}
interface Parameter {
start: number; // The time that marks the beginning of a Polygon. The timestamp is in microseconds.
end: number; // The time that marks the end of a Polygon. The timestamp is in microseconds.
timestamps: Timestamp[]; // Shows information about a Polygon at specific timestamps (start, end, edit).
}
interface Timestamp {
points: number[]; // Points of the Polygon in this location on the timeline.
timestamp: number; // Timestamp that marks the change of the Polygon. The timestamp in microseconds.
attributes: Attribute[]; // List of attributes for the Polygon, in this location on a timeline.
}
interface Attribute {
id: number; // Attribute ID (must be in “classes.json”)
groupId: number; // Group ID (must be in “classes.json”)
name: string; // Attribute name
groupName: string; // Attributes group name
}
type PolylineData = {
meta: {
type: string;
classId: number;
className?: string;
createdBy: {
email: string;
role: string;
};
createdAt: string;
updatedBy: {
email: string;
role: string;
};
updatedAt: string;
start: number;
end: number;
creationType: string;
};
parameters: {
start: number;
end: number;
timestamps: {
points: number[];
timestamp: number;
attributes: {
id: number;
groupId: number;
name: string;
groupName: string;
}[];
}[];
}[];
};
type TagData = {
meta: {
type: string;
classId: number;
creationType: string;
className: string;
createdBy: {
email: string;
role: string;
};
createdAt: string;
updatedBy: {
email: string;
role: string;
};
updatedAt: string;
attributes: {
id: number;
groupId: number;
name: string;
groupName: string;
}[];
probability?: number;
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment