r/frigate_nvr • • 13d ago

State Classification not getting samples (camera set to record)

I have record setup on my camera and can see recordings, however, the state classification does not seem to be grabbing state images. The object classification engine is working though. Anyone have an idea why I'm not seeing training samples?

  # Reolink FEP
  garage:
    enabled: true
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/garage
          roles:
            - record
            - detect
            - audio
          input_args: preset-rtsp-restream
    detect:
      width: 720
      height: 720
    live:
      streams:
        Stream 1: garage
    audio:
      enabled: true
    zones:
      zone_garage:
        coordinates: 
          0.272,0.088,0.328,0.169,0.474,0.127,0.635,0.139,0.666,0.042,0.979,0.037,0.995,0.99,0,1,0,0.009
        enabled: true
        inertia: 3
        loitering_time: 0
      zone_driveway:
        coordinates: 
          0.292,0.094,0.333,0.165,0.474,0.125,0.63,0.139,0.648,0.078,0.467,0.062
        enabled: true
        inertia: 3
        loitering_time: 0
    review:
      alerts:
        required_zones:
          - zone_driveway

...................

classification:
  bird:
    enabled: false
  custom:
    Cars:
      enabled: true
      name: Cars
      threshold: 0.8
      object_config:
        objects:
          - car
        classification_type: sub_label
    Family Motorcycles:
      enabled: true
      name: Family Motorcycles
      threshold: 0.8
      object_config:
        objects:
          - motorcycle
        classification_type: sub_label
    Car Charging:
      enabled: true
      name: Car Charging
      threshold: 0.8
      state_config:
        cameras:
          garage:
            crop:
              - 0.35403136036397453
              - 0.2264359831245339
              - 0.45779287174264244
              - 0.3301974945032018
        motion: true
        interval: 120
      save_attempts: 100
2 Upvotes

4 comments sorted by

2

u/hawkeye217 Developer 13d ago

Your config looks fine. This is most likely expected behavior rather than a config issue.

State classification doesn't save every attempt the way object classification does. An image only shows up in Recent Classifications when the state is changing (or a change is being verified), or when the score is below 100%. If the state is stable and the model is scoring 100%, nothing is saved. A small fixed crop of a charger in a garage is pretty much the ideal case for that, so the model is probably just confidently reporting the same state every 2 minutes.

See the docs: https://docs.frigate.video/configuration/custom_classification/state_classification#recent-classifications

1

u/zonyln 13d ago

Ive actually removed the charger, moved the car, blocked the camera with my body and still havent seen a change. Any way to trigger a capture manually?

2

u/hawkeye217 Developer 13d ago

No, there's no way to trigger a capture manually. Blocking the camera should definitely have produced samples though. You should first check if the model was successfully trained. Training needs at least 2 classes with images in them, and it will fail if you only have one.

Check your Frigate logs for `Finished training Car Charging` or `Training failed for Car Charging`, and see whether `/config/model_cache/Car Charging/model.tflite` exists. If it doesn't, add images to at least two classes and hit train again.

You can also look at System Metrics > Enrichments. If the Car Charging classification speed there is 0, the model has never run.

1

u/zonyln 13d ago

Ah. I think I see the dilemma. I had just added the camera and there were no recorded images yet so when I created the classifiers there were no images to select from.

I deleted the classifiers and added them back and sample images appeared this time upon creation.