nabang1010 / YOLOv8_Object_Tracking_TensorRT

YOLOv8 Object Tracking TensorRT
https://nabang1010.com/2024/02/11/YOLOv8-Object-Tracking-TensorRT/
MIT License
8 stars 3 forks source link

There was nothing detect? #2

Closed lovechang1986 closed 3 months ago

lovechang1986 commented 3 months ago

I tested the sample video and had no problem recognizing and tracking it ok. But when I use my phone to record a video about traffic flow on an overpass, it seems that the recognition and tracking don't work, also I used YOLOv8 from the reference repository, and after compiling it, I found that the video is able to recognize some content, I don't know why this is the case?

nabang1010 commented 3 months ago

Look at scripts from line 92 to line 97 in yolov8_deepsort_trt.py

    for (bbox, score, label) in zip(bboxes, scores, labels):
        if label == 0 and score.item() > 0.3:
            bbox = bbox.round().int().tolist()
            cls_id = int(label)
            cls = CLASSES[cls_id]
            detections.append((bbox[0], bbox[1], bbox[2] , bbox[3], cls, score.item()))

The pre-trained model has 80 classes but I only used class 0 (person) to do in the sample video. So I used if label == 0 to filter.

You can refer list classes:

  0: person
  1: bicycle
  2: car
  3: motorcycle
  4: airplane
  5: bus
  6: train
  7: truck
  8: boat
  9: traffic light
  10: fire hydrant
  11: stop sign
  12: parking meter
  13: bench
  14: bird
  15: cat
  16: dog
  17: horse
  18: sheep
  19: cow
  20: elephant
  21: bear
  22: zebra
  23: giraffe
  24: backpack
  25: umbrella
  26: handbag
  27: tie
  28: suitcase
  29: frisbee
  30: skis
  31: snowboard
  32: sports ball
  33: kite
  34: baseball bat
  35: baseball glove
  36: skateboard
  37: surfboard
  38: tennis racket
  39: bottle
  40: wine glass
  41: cup
  42: fork
  43: knife
  44: spoon
  45: bowl
  46: banana
  47: apple
  48: sandwich
  49: orange
  50: broccoli
  51: carrot
  52: hot dog
  53: pizza
  54: donut
  55: cake
  56: chair
  57: couch
  58: potted plant
  59: bed
  60: dining table
  61: toilet
  62: tv
  63: laptop
  64: mouse
  65: remote
  66: keyboard
  67: cell phone
  68: microwave
  69: oven
  70: toaster
  71: sink
  72: refrigerator
  73: book
  74: clock
  75: vase
  76: scissors
  77: teddy bear
  78: hair drier
  79: toothbrush
lovechang1986 commented 3 months ago

Yes, if logic control is done here. Thanks.