Qidian213 / deep_sort_yolov3

Real-time Multi-person tracker using YOLO v3 and deep_sort with tensorflow
GNU General Public License v3.0
1.66k stars 591 forks source link

Anybody use it with your own .h5? #57

Open louxy126 opened 6 years ago

louxy126 commented 6 years ago

I would like to track cars and pedestrians,so I trained a model with https://github.com/qqwweee/keras-yolo3 ,and the model is trained_weights.h5. I chenged the path in yolo.py to self.model_path = '~/PycharmProjects/keras-yolo3-master/logs/000/trained_weights.h5' self.anchors_path = '~/PycharmProjects/keras-yolo3-master/model_data/yolo_anchors.txt' self.classes_path = '~/PycharmProjects/keras-yolo3-master/model_data/voc_classes.txt' the yolo_anchors.txt and voc_classes.txt' are what I used when train trained_weights.h5. but when i python demo.py ,error
Traceback (most recent call last): File "/media/jsu/205E470B5E46D8E4/lxy/deep_sort_yolov3/demo.py", line 112, in main(YOLO()) File "/media/jsu/205E470B5E46D8E4/lxy/deep_sort_yolov3/yolo.py", line 33, in init self.boxes, self.scores, self.classes = self.generate() File "/media/jsu/205E470B5E46D8E4/lxy/deep_sort_yolov3/yolo.py", line 54, in generate self.yolo_model = load_model(model_path, compile=False) File "/home/jsu/anaconda3/envs/deep_sort/lib/python3.5/site-packages/keras/models.py", line 241, in load_model raise ValueError('No model found in config file.') ValueError: No model found in config file. anybody know how to deal with it? thanks!

louxy126 commented 6 years ago

i use the yolo.h5 provided by this hub and follw this https://github.com/Qidian213/deep_sort_yolov3/issues/7 it is very funny that it works to tracking cars

louxy126 commented 6 years ago

when i change ` if predicted_class != 'car' : continue box = out_boxes[i]

score = out_scores[i]

         x = int(box[1])
         y = int(box[0])
         w = int(box[3]-box[1])
         h = int(box[2]-box[0])
         if x < 0 :
             w = w + x
             x = 0
        if y < 0 :
             h = h + y
             y = 0
        return_boxs.append([x,y,w,h])`

to ` if predicted_class == 'car' or 'person':

            box = out_boxes[i]
            # score = out_scores[i]
            x = int(box[1])
            y = int(box[0])
            w = int(box[3] - box[1])
            h = int(box[2] - box[0])
            if x < 0:
                w = w + x
                x = 0
            if y < 0:
                h = h + y
                y = 0
            return_boxs.append([x, y, w, h])
    return return_boxs`

it can track cars and person at the same time,but trafficlight 、bicyclist are also tracked!!!! and the outcome is not good,and i still want to find how to use my own model!

louxy126 commented 6 years ago

i think this is because the default yolo.h5 is trained in coco which contains 80 classes!

Qidian213 commented 6 years ago

I afraid that it can track cars and person at the same time,but trafficlight 、bicyclist are also tracked!!!! because of the model you trained was not performs well. And i found that the deep sort model also need to improve.

GuanzhaoLi commented 6 years ago

Did you solve the problem? I have the exact same error when try to use self-trained .h5 file.

louxy126 commented 6 years ago

@GuanzhaoLi 可以的,是博主的整合代码的时候没有把那部分放进去,我过两天fork一下博主的,然后把那部分的代码更新一下

GuanzhaoLi commented 6 years ago

多谢大佬,能问一下到底是哪部分代码导致的不能使用keras yolo 训练出来的模型吗?

ss199302 commented 5 years ago

@louxy126 您好,我也有这个问题,请问怎么改变代码呢

ss199302 commented 5 years ago

@louxy126 请问现在您的代码可以使用自己训练的h5模型吗

lmhlll commented 5 years ago

I want to run with local video. What should I do? Looking forward to reply.