Edit model card

Returns with about 22% accuracy the type of a crime seen in a CCTV camera image.

An example how to invoke this model together with the previous one for a given image:

# Import the 'pipeline' function from the 'transformers' library.
from transformers import pipeline

pipe1 = pipeline('image-classification', model="dima806/crime_cctv_image_detection", device=0)
pipe2 = pipeline('image-classification', model="dima806/crime_type_cctv_image_detection", device=0)

# Apply the 'pipe1' function to process the 'image' variable to see if there is a high probability for crime.
res1 = pipe1(image)
crime_score = [res['score'] for res in res1 if res['label']=='Crime'][0]
print(f"Crime score: {round(crime_score, 3)}" )
threshold = 0.5
if crime_score > threshold:
    # apply second pipeline to check the crime type
    print("There is a potential crime")
    res2 = pipe2(image)
    print("Top scores for crime types:")
    for res in res2:
        print(f"For {res['label']}: {round(res['score'], 3)}")

See https://www.kaggle.com/code/dima806/crime-types-cctv-detection-vit for more details.

image/png

Classification report:

               precision    recall  f1-score   support

        Abuse     0.0831    0.4411    0.1399       297
       Arrest     0.3701    0.2383    0.2899      3365
        Arson     0.2103    0.2707    0.2367      2793
      Assault     0.0135    0.0083    0.0103      2657
     Burglary     0.4341    0.2628    0.3274      7657
    Explosion     0.8575    0.1220    0.2136      6510
     Fighting     0.1200    0.4119    0.1858      1231
RoadAccidents     0.2454    0.6568    0.3573      2663
      Robbery     0.0170    0.2240    0.0316       835
     Shooting     0.4182    0.0706    0.1209      7630
  Shoplifting     0.9057    0.2457    0.3865      7623
     Stealing     0.1380    0.2198    0.1696      1984
    Vandalism     0.0980    0.2601    0.1423      1111

     accuracy                         0.2178     46356
    macro avg     0.3008    0.2640    0.2009     46356
 weighted avg     0.4766    0.2178    0.2410     46356
Downloads last month
19
Safetensors
Model size
85.8M params
Tensor type
F32
·
Inference API
Unable to determine this model's library. Check the docs .

Model tree for dima806/crime_type_cctv_image_detection

Finetuned
(1724)
this model