Skip to content

[RSDK-10140] add relative bounding box coordinates to detections #640

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions gen/js/service/vision/v1/vision_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,26 @@ export class Detection extends jspb.Message {
getClassName(): string;
setClassName(value: string): void;

hasXMinNormalized(): boolean;
clearXMinNormalized(): void;
getXMinNormalized(): number;
setXMinNormalized(value: number): void;

hasYMinNormalized(): boolean;
clearYMinNormalized(): void;
getYMinNormalized(): number;
setYMinNormalized(value: number): void;

hasXMaxNormalized(): boolean;
clearXMaxNormalized(): void;
getXMaxNormalized(): number;
setXMaxNormalized(value: number): void;

hasYMaxNormalized(): boolean;
clearYMaxNormalized(): void;
getYMaxNormalized(): number;
setYMaxNormalized(value: number): void;

serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Detection.AsObject;
static toObject(includeInstance: boolean, msg: Detection): Detection.AsObject;
Expand All @@ -170,6 +190,10 @@ export namespace Detection {
yMax: number,
confidence: number,
className: string,
xMinNormalized: number,
yMinNormalized: number,
xMaxNormalized: number,
yMaxNormalized: number,
}
}

Expand Down
194 changes: 193 additions & 1 deletion gen/js/service/vision/v1/vision_pb.js
Original file line number Diff line number Diff line change
Expand Up @@ -1268,7 +1268,11 @@ proto.viam.service.vision.v1.Detection.toObject = function(includeInstance, msg)
xMax: jspb.Message.getFieldWithDefault(msg, 3, 0),
yMax: jspb.Message.getFieldWithDefault(msg, 4, 0),
confidence: jspb.Message.getFloatingPointFieldWithDefault(msg, 5, 0.0),
className: jspb.Message.getFieldWithDefault(msg, 6, "")
className: jspb.Message.getFieldWithDefault(msg, 6, ""),
xMinNormalized: jspb.Message.getFloatingPointFieldWithDefault(msg, 7, 0.0),
yMinNormalized: jspb.Message.getFloatingPointFieldWithDefault(msg, 8, 0.0),
xMaxNormalized: jspb.Message.getFloatingPointFieldWithDefault(msg, 9, 0.0),
yMaxNormalized: jspb.Message.getFloatingPointFieldWithDefault(msg, 10, 0.0)
};

if (includeInstance) {
Expand Down Expand Up @@ -1329,6 +1333,22 @@ proto.viam.service.vision.v1.Detection.deserializeBinaryFromReader = function(ms
var value = /** @type {string} */ (reader.readString());
msg.setClassName(value);
break;
case 7:
var value = /** @type {number} */ (reader.readDouble());
msg.setXMinNormalized(value);
break;
case 8:
var value = /** @type {number} */ (reader.readDouble());
msg.setYMinNormalized(value);
break;
case 9:
var value = /** @type {number} */ (reader.readDouble());
msg.setXMaxNormalized(value);
break;
case 10:
var value = /** @type {number} */ (reader.readDouble());
msg.setYMaxNormalized(value);
break;
default:
reader.skipField();
break;
Expand Down Expand Up @@ -1400,6 +1420,34 @@ proto.viam.service.vision.v1.Detection.serializeBinaryToWriter = function(messag
f
);
}
f = /** @type {number} */ (jspb.Message.getField(message, 7));
if (f != null) {
writer.writeDouble(
7,
f
);
}
f = /** @type {number} */ (jspb.Message.getField(message, 8));
if (f != null) {
writer.writeDouble(
8,
f
);
}
f = /** @type {number} */ (jspb.Message.getField(message, 9));
if (f != null) {
writer.writeDouble(
9,
f
);
}
f = /** @type {number} */ (jspb.Message.getField(message, 10));
if (f != null) {
writer.writeDouble(
10,
f
);
}
};


Expand Down Expand Up @@ -1583,6 +1631,150 @@ proto.viam.service.vision.v1.Detection.prototype.setClassName = function(value)
};


/**
* optional double x_min_normalized = 7;
* @return {number}
*/
proto.viam.service.vision.v1.Detection.prototype.getXMinNormalized = function() {
return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 7, 0.0));
};


/**
* @param {number} value
* @return {!proto.viam.service.vision.v1.Detection} returns this
*/
proto.viam.service.vision.v1.Detection.prototype.setXMinNormalized = function(value) {
return jspb.Message.setField(this, 7, value);
};


/**
* Clears the field making it undefined.
* @return {!proto.viam.service.vision.v1.Detection} returns this
*/
proto.viam.service.vision.v1.Detection.prototype.clearXMinNormalized = function() {
return jspb.Message.setField(this, 7, undefined);
};


/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.viam.service.vision.v1.Detection.prototype.hasXMinNormalized = function() {
return jspb.Message.getField(this, 7) != null;
};


/**
* optional double y_min_normalized = 8;
* @return {number}
*/
proto.viam.service.vision.v1.Detection.prototype.getYMinNormalized = function() {
return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 8, 0.0));
};


/**
* @param {number} value
* @return {!proto.viam.service.vision.v1.Detection} returns this
*/
proto.viam.service.vision.v1.Detection.prototype.setYMinNormalized = function(value) {
return jspb.Message.setField(this, 8, value);
};


/**
* Clears the field making it undefined.
* @return {!proto.viam.service.vision.v1.Detection} returns this
*/
proto.viam.service.vision.v1.Detection.prototype.clearYMinNormalized = function() {
return jspb.Message.setField(this, 8, undefined);
};


/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.viam.service.vision.v1.Detection.prototype.hasYMinNormalized = function() {
return jspb.Message.getField(this, 8) != null;
};


/**
* optional double x_max_normalized = 9;
* @return {number}
*/
proto.viam.service.vision.v1.Detection.prototype.getXMaxNormalized = function() {
return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 9, 0.0));
};


/**
* @param {number} value
* @return {!proto.viam.service.vision.v1.Detection} returns this
*/
proto.viam.service.vision.v1.Detection.prototype.setXMaxNormalized = function(value) {
return jspb.Message.setField(this, 9, value);
};


/**
* Clears the field making it undefined.
* @return {!proto.viam.service.vision.v1.Detection} returns this
*/
proto.viam.service.vision.v1.Detection.prototype.clearXMaxNormalized = function() {
return jspb.Message.setField(this, 9, undefined);
};


/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.viam.service.vision.v1.Detection.prototype.hasXMaxNormalized = function() {
return jspb.Message.getField(this, 9) != null;
};


/**
* optional double y_max_normalized = 10;
* @return {number}
*/
proto.viam.service.vision.v1.Detection.prototype.getYMaxNormalized = function() {
return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 10, 0.0));
};


/**
* @param {number} value
* @return {!proto.viam.service.vision.v1.Detection} returns this
*/
proto.viam.service.vision.v1.Detection.prototype.setYMaxNormalized = function(value) {
return jspb.Message.setField(this, 10, value);
};


/**
* Clears the field making it undefined.
* @return {!proto.viam.service.vision.v1.Detection} returns this
*/
proto.viam.service.vision.v1.Detection.prototype.clearYMaxNormalized = function() {
return jspb.Message.setField(this, 10, undefined);
};


/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.viam.service.vision.v1.Detection.prototype.hasYMaxNormalized = function() {
return jspb.Message.getField(this, 10) != null;
};





Expand Down
5 changes: 5 additions & 0 deletions proto/viam/service/vision/v1/vision.proto
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ message Detection {
double confidence = 5;
// label associated with the detected object
string class_name = 6;
// the four corners of the box, in proportion to the respective image dimension
optional double x_min_normalized = 7;
optional double y_min_normalized = 8;
optional double x_max_normalized = 9;
optional double y_max_normalized = 10;
}

message GetClassificationsRequest {
Expand Down
60 changes: 55 additions & 5 deletions service/vision/v1/vision.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading