mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-23 01:21:40 +00:00
Add RKNN / Object Detection Pipeline (#1144)
Tested on Orange Pi 5 and Cool Pi 4B. Merge with parts of the OpenCV DNN PR. Adds support for YOLOv5s models for Rockchip CPUs with a NPU. Right now hard coded to a note model from alex_idk. Very much still incubating and largely untested.
This commit is contained in:
@@ -54,6 +54,8 @@ export interface PhotonTarget {
|
||||
ambiguity: number;
|
||||
// -1 if not set
|
||||
fiducialId: number;
|
||||
confidence: number;
|
||||
classId: number;
|
||||
// undefined if 3d isn't enabled
|
||||
pose?: Transform3d;
|
||||
}
|
||||
@@ -70,4 +72,6 @@ export interface PipelineResult {
|
||||
targets: PhotonTarget[];
|
||||
// undefined if multitag failed or non-tag pipeline
|
||||
multitagResult?: MultitagResult;
|
||||
// Object detection class names -- empty if not doing object detection
|
||||
classNames: string[];
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@ export enum PipelineType {
|
||||
Reflective = 2,
|
||||
ColoredShape = 3,
|
||||
AprilTag = 4,
|
||||
Aruco = 5
|
||||
Aruco = 5,
|
||||
ObjectDetection = 6
|
||||
}
|
||||
|
||||
export enum AprilTagFamily {
|
||||
@@ -281,14 +282,39 @@ export const DefaultArucoPipelineSettings: ArucoPipelineSettings = {
|
||||
doSingleTargetAlways: false
|
||||
};
|
||||
|
||||
export interface ObjectDetectionPipelineSettings extends PipelineSettings {
|
||||
pipelineType: PipelineType.ObjectDetection;
|
||||
confidence: number;
|
||||
nms: number;
|
||||
box_thresh: number;
|
||||
}
|
||||
export type ConfigurableObjectDetectionPipelineSettings = Partial<
|
||||
Omit<ObjectDetectionPipelineSettings, "pipelineType">
|
||||
> &
|
||||
ConfigurablePipelineSettings;
|
||||
export const DefaultObjectDetectionPipelineSettings: ObjectDetectionPipelineSettings = {
|
||||
...DefaultPipelineSettings,
|
||||
pipelineType: PipelineType.ObjectDetection,
|
||||
cameraGain: 20,
|
||||
targetModel: TargetModel.InfiniteRechargeHighGoalOuter,
|
||||
ledMode: true,
|
||||
outputShowMultipleTargets: false,
|
||||
cameraExposure: 6,
|
||||
confidence: 0.9,
|
||||
nms: 0.45,
|
||||
box_thresh: 0.25
|
||||
};
|
||||
|
||||
export type ActivePipelineSettings =
|
||||
| ReflectivePipelineSettings
|
||||
| ColoredShapePipelineSettings
|
||||
| AprilTagPipelineSettings
|
||||
| ArucoPipelineSettings;
|
||||
| ArucoPipelineSettings
|
||||
| ObjectDetectionPipelineSettings;
|
||||
|
||||
export type ActiveConfigurablePipelineSettings =
|
||||
| ConfigurableReflectivePipelineSettings
|
||||
| ConfigurableColoredShapePipelineSettings
|
||||
| ConfigurableAprilTagPipelineSettings
|
||||
| ConfigurableArucoPipelineSettings;
|
||||
| ConfigurableArucoPipelineSettings
|
||||
| ConfigurableObjectDetectionPipelineSettings;
|
||||
|
||||
@@ -7,6 +7,7 @@ export interface GeneralSettings {
|
||||
hardwareModel?: string;
|
||||
hardwarePlatform?: string;
|
||||
mrCalWorking: boolean;
|
||||
rknnSupported: boolean;
|
||||
}
|
||||
|
||||
export interface MetricData {
|
||||
|
||||
@@ -101,5 +101,6 @@ export enum WebsocketPipelineType {
|
||||
Reflective = 0,
|
||||
ColoredShape = 1,
|
||||
AprilTag = 2,
|
||||
Aruco = 3
|
||||
Aruco = 3,
|
||||
ObjectDetection = 4
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user