Add YOLO11 Support (#1736)

This commit is contained in:
Sam Freund
2025-02-08 19:11:01 -06:00
committed by GitHub
parent ef82328d74
commit 7067c75525
4 changed files with 9 additions and 4 deletions

View File

@@ -40,7 +40,7 @@ ext {
joglVersion = "2.4.0"
javalinVersion = "5.6.2"
libcameraDriverVersion = "v2025.0.3"
rknnVersion = "v2025.0.0"
rknnVersion = "dev-v2025.0.0-1-g33b6263"
frcYear = "2025"
mrcalVersion = "v2025.0.0";

View File

@@ -44,7 +44,7 @@ Before beginning, it is necessary to install the [rknn-toolkit2](https://github.
## Uploading Custom Models
:::{warning}
PhotonVision currently ONLY supports 640x640 YOLOv5 & YOLOv8 models trained and converted to `.rknn` format for RK3588 CPUs! Other models require different post-processing code and will NOT work. The model conversion process is also highly particular. Proceed with care.
PhotonVision currently ONLY supports 640x640 YOLOv5, YOLOv8, and YOLO11 models trained and converted to `.rknn` format for RK3588 CPUs! Other models require different post-processing code and will NOT work. The model conversion process is also highly particular. Proceed with care.
:::
In the settings, under `Device Control`, there's an option to upload a new object detection model. Naming convention

View File

@@ -39,6 +39,8 @@ public class RknnModel implements Model {
*
* <p>"yolov8" -> "YOLO_V8"
*
* <p>"yolov11" -> "YOLO_V11"
*
* @param modelName The model's filename
* @return The model version
*/
@@ -48,6 +50,8 @@ public class RknnModel implements Model {
return RknnJNI.ModelVersion.YOLO_V5;
} else if (modelName.contains("yolov8")) {
return RknnJNI.ModelVersion.YOLO_V8;
} else if (modelName.contains("yolov11")) {
return RknnJNI.ModelVersion.YOLO_V11;
} else {
throw new IllegalArgumentException("Unknown model version for model " + modelName);
}

View File

@@ -575,10 +575,11 @@ public class RequestHandler {
// verify naming convention
// this check will need to be modified if different model types are added
Pattern modelPattern = Pattern.compile("^[a-zA-Z0-9]+-\\d+-\\d+-yolov[58][a-z]*\\.rknn$");
Pattern modelPattern =
Pattern.compile("^[a-zA-Z0-9]+-\\d+-\\d+-yolov(?:5|8|11)[a-z]*\\.rknn$");
Pattern labelsPattern =
Pattern.compile("^[a-zA-Z0-9]+-\\d+-\\d+-yolov[58][a-z]*-labels\\.txt$");
Pattern.compile("^[a-zA-Z0-9]+-\\d+-\\d+-yolov(?:5|8|11)[a-z]*-labels\\.txt$");
if (!modelPattern.matcher(modelFile.filename()).matches()
|| !labelsPattern.matcher(labelsFile.filename()).matches()