diff --git a/docs/docs/configuration/custom_classification/object_classification.md b/docs/docs/configuration/custom_classification/object_classification.md new file mode 100644 index 000000000..a75aae31a --- /dev/null +++ b/docs/docs/configuration/custom_classification/object_classification.md @@ -0,0 +1,73 @@ +--- +id: object_classification +title: Object Classification +--- + +Object classification allows you to train a custom MobileNetV2 classification model to run on tracked objects (persons, cars, animals, etc.) to identify a finer category or attribute for that object. + +## Minimum System Requirements + +Object classification models are lightweight and run very fast on CPU. Inference should be usable on virtually any machine that can run Frigate. + +Training the model does briefly use a high amount of system resources for about 1–3 minutes per training run. On lower-power devices, training may take longer. +When running the `-tensorrt` image, Nvidia GPUs will automatically be used to accelerate training. + +### Sub label vs Attribute + +- **Sub label**: + + - Applied to the object’s `sub_label` field. + - Ideal for a single, more specific identity or type. + - Example: `cat` → `Leo`, `Charlie`, `None`. + +- **Attribute**: + - Added as metadata to the object (visible in /events): `: `. + - Ideal when multiple attributes can coexist independently. + - Example: Detecting if a `person` in a construction yard is wearing a helmet or not. + +## Example use cases + +### Sub label + +- **Known pet vs unknown**: For `dog` objects, set sub label to your pet’s name (e.g., `buddy`) or `none` for others. +- **Mail truck vs normal car**: For `car`, classify as `mail_truck` vs `car` to filter important arrivals. +- **Delivery vs non-delivery person**: For `person`, classify `delivery` vs `visitor` based on uniform/props. + +### Attributes + +- **Backpack**: For `person`, add attribute `backpack: yes/no`. +- **Helmet**: For `person` (worksite), add `helmet: yes/no`. +- **Leash**: For `dog`, add `leash: yes/no` (useful for park or yard rules). +- **Ladder rack**: For `truck`, add `ladder_rack: yes/no` to flag service vehicles. + +## Configuration + +Object classification is configured as a custom classification model. Each model has its own name and settings. You must list which object labels should be classified. + +```yaml +classification: + custom: + dog: + threshold: 0.8 + object_config: + objects: [dog] # object labels to classify + classification_type: sub_label # or: attribute +``` + +## Training the model + +Creating and training the model is done within the Frigate UI using the `Classification` page. + +### Getting Started + +When choosing which objects to classify, start with a small number of visually distinct classes and ensure your training samples match camera viewpoints and distances typical for those objects. + +// TODO add this section once UI is implemented. Explain process of selecting objects and curating training examples. + +### Improving the Model + +- **Problem framing**: Keep classes visually distinct and relevant to the chosen object types. +- **Data collection**: Use the model’s Train tab to gather balanced examples across times of day, weather, and distances. +- **Preprocessing**: Ensure examples reflect object crops similar to Frigate’s boxes; keep the subject centered. +- **Labels**: Keep label names short and consistent; include a `none` class if you plan to ignore uncertain predictions for sub labels. +- **Threshold**: Tune `threshold` per model to reduce false assignments. Start at `0.8` and adjust based on validation. diff --git a/docs/docs/configuration/custom_classification/state_classification.md b/docs/docs/configuration/custom_classification/state_classification.md new file mode 100644 index 000000000..ec38ea696 --- /dev/null +++ b/docs/docs/configuration/custom_classification/state_classification.md @@ -0,0 +1,52 @@ +--- +id: state_classification +title: State Classification +--- + +State classification allows you to train a custom MobileNetV2 classification model on a fixed region of your camera frame(s) to determine a current state. The model can be configured to run on a schedule and/or when motion is detected in that region. + +## Minimum System Requirements + +State classification models are lightweight and run very fast on CPU. Inference should be usable on virtually any machine that can run Frigate. + +Training the model does briefly use a high amount of system resources for about 1–3 minutes per training run. On lower-power devices, training may take longer. +When running the `-tensorrt` image, Nvidia GPUs will automatically be used to accelerate training. + +## Example use cases + +- **Door state**: Detect if a garage or front door is open vs closed. +- **Gate state**: Track if a driveway gate is open or closed. +- **Trash day**: Bins at curb vs no bins present. +- **Pool cover**: Cover on vs off. + +## Configuration + +State classification is configured as a custom classification model. Each model has its own name and settings. You must provide at least one camera crop under `state_config.cameras`. + +```yaml +classification: + custom: + front_door: + threshold: 0.8 + state_config: + motion: true # run when motion overlaps the crop + interval: 10 # also run every N seconds (optional) + cameras: + front: + crop: [0, 180, 220, 400] +``` + +## Training the model + +Creating and training the model is done within the Frigate UI using the `Classification` page. + +### Getting Started + +When choosing a portion of the camera frame for state classification, it is important to make the crop tight around the area of interest to avoid extra signals unrelated to what is being classified. + +// TODO add this section once UI is implemented. Explain process of selecting a crop. + +### Improving the Model + +- **Problem framing**: Keep classes visually distinct and state-focused (e.g., `open`, `closed`, `unknown`). Avoid combining object identity with state in a single model unless necessary. +- **Data collection**: Use the model’s Train tab to gather balanced examples across times of day and weather. diff --git a/docs/sidebars.ts b/docs/sidebars.ts index 06e7b51d6..16f0c95a4 100644 --- a/docs/sidebars.ts +++ b/docs/sidebars.ts @@ -40,6 +40,19 @@ const sidebars: SidebarsConfig = { "configuration/face_recognition", "configuration/license_plate_recognition", "configuration/bird_classification", + { + type: "category", + label: "Custom Classification", + link: { + type: "generated-index", + title: "Custom Classification", + description: "Configuration for custom classification models", + }, + items: [ + "configuration/custom_classification/state_classification", + "configuration/custom_classification/object_classification", + ], + }, { type: "category", label: "Generative AI",