AlexeyAB / darknet

YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object Detection (Windows and Linux version of Darknet )
http://pjreddie.com/darknet/
Other
21.75k stars 7.96k forks source link

strange error with number of classes(mixing of two models) #2740

Open buzdarbalooch opened 5 years ago

buzdarbalooch commented 5 years ago

hi , i am able to successfully detect objects using it as a object detectors, but when i try to tracking with yolo. it gives strange with the number of classes it also detects classes it was not trained for. for example previously i trained the model for 3 classes . now with my new i have 4 different classes. when i do tracking, it also tracks the previous model.

buzdarbalooch commented 5 years ago
Screenshot 2019-03-22 10 50 51

attaching the cfg file, i made sure for new datset i changed the number of filters and classes in the cfg file

buzdarbalooch commented 5 years ago

@AlexeyAB

buzdarbalooch commented 5 years ago

this is the cfg file

[net]

Testing

batch=24 subdivisions=8

Training

batch=64

subdivisions=8

height=416 width=416 channels=3 momentum=0.9 decay=0.0005 angle=0 saturation = 1.5 exposure = 1.5 hue=.1

learning_rate=0.001 burn_in=1000 max_batches = 500200 policy=steps steps=400000,450000 scales=.1,.1

[convolutional] batch_normalize=1 filters=32 size=3 stride=1 pad=1 activation=leaky

[maxpool] size=2 stride=2

[convolutional] batch_normalize=1 filters=64 size=3 stride=1 pad=1 activation=leaky

[maxpool] size=2 stride=2

[convolutional] batch_normalize=1 filters=128 size=3 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=64 size=1 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=128 size=3 stride=1 pad=1 activation=leaky

[maxpool] size=2 stride=2

[convolutional] batch_normalize=1 filters=256 size=3 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=128 size=1 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=256 size=3 stride=1 pad=1 activation=leaky

[maxpool] size=2 stride=2

[convolutional] batch_normalize=1 filters=512 size=3 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=256 size=1 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=512 size=3 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=256 size=1 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=512 size=3 stride=1 pad=1 activation=leaky

[maxpool] size=2 stride=2

[convolutional] batch_normalize=1 filters=1024 size=3 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=512 size=1 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=1024 size=3 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=512 size=1 stride=1 pad=1 activation=leaky

[convolutional] batch_normalize=1 filters=1024 size=3 stride=1 pad=1 activation=leaky

#######

[convolutional] batch_normalize=1 size=3 stride=1 pad=1 filters=1024 activation=leaky

[convolutional] batch_normalize=1 size=3 stride=1 pad=1 filters=1024 activation=leaky

[route] layers=-9

[convolutional] batch_normalize=1 size=1 stride=1 pad=1 filters=64 activation=leaky

[reorg] stride=2

[route] layers=-1,-4

[convolutional] batch_normalize=1 size=3 stride=1 pad=1 filters=1024 activation=leaky

[convolutional] size=1 stride=1 pad=1 filters=45 activation=linear

[region] anchors = 0.57273, 0.677385, 1.87446, 2.06253, 3.33843, 5.47434, 7.88282, 3.52778, 9.77052, 9.16828 bias_match=1 classes=4 coords=4 num=5 softmax=1 jitter=.3 rescore=1

object_scale=5 noobject_scale=1 class_scale=1 coord_scale=1

absolute=1 thresh = .6 random=1

buzdarbalooch commented 5 years ago
error

here if u see, for example, for my model, i trained it with 4 classes(player, ball, flag, goalpost). but while tracking it tracks (cars, handicap,people) which was an old model for which i trained the system

buzdarbalooch commented 5 years ago

Dear @AlexeyAB can u also give any suggestions for the problem

AlexeyAB commented 5 years ago

@buzdarbalooch What command do you use?

Check your names file.

buzdarbalooch commented 5 years ago

yeah i removed the files data/names. which was in the same folder with different classes of my previous mode (car, handicap), now i dont get the previous class names while performing tracking.

i am using this command "LD_LIBRARY_PATH=./:$LD_LIBRARY_PATH ./uselib data/obj1.names cfg/yolo.cfg Backup/yolo_10400.weights cornerclip.mov

obj1.names has four names inside (player, ball, goalpost, flag), i dont see any resultswith names in tracking. see below what i get. interestingly for the same classes, detection works fine.

error1 error2
AlexeyAB commented 5 years ago

Can you show screenshot of this command?

./darknet detector demo data/obj1.data cfg/yolo.cfg Backup/yolo_10400.weights cornerclip.mov

It looks like you use wrong cfg-file.

buzdarbalooch commented 5 years ago
error3
buzdarbalooch commented 5 years ago

here you go the screen shot for the command u mentioned

error4
buzdarbalooch commented 5 years ago

hi @AlexeyAB i tried on another football (soccer) dataset also, again same issue, detection works fine, but when i try to execute the tracking there is always such result

errror tracking
buzdarbalooch commented 5 years ago

i am also attaching the detector demo command thats working fine for me.

detector demo
AlexeyAB commented 5 years ago

detection works fine, but when i try to execute the tracking there is always such result

Show screenshot of tracking command.

buzdarbalooch commented 5 years ago

this is the command ./:$LD_LIBRARY_PATH ./uselib data/obj2.names cfg/yolov2.cfg Backup/yolov2_3700.weights freekick.mov

Screenshot 2019-04-01 12 12 11

here in the screen shot below is the command above is the tracking output

AlexeyAB commented 5 years ago

Can you successfully detect on Image instead of Video by using ./uselib ?

Did you un-comment? https://github.com/AlexeyAB/darknet/blob/6231b748c44e2007b5c3cbf765a50b122782c5a2/src/yolo_console_dll.cpp#L16

buzdarbalooch commented 5 years ago

yes its uncommented . how does it work for images. i tried just now using this command , but i am not aware where results are saved

./:$LD_LIBRARY_PATH ./uselib data/obj2.names cfg/yolov2.cfg Backup/yolov2_3700.weights experi.jpg.

uselib_img
AlexeyAB commented 5 years ago

but i am not aware where results are saved

Also un-comment this line: https://github.com/AlexeyAB/darknet/blob/6231b748c44e2007b5c3cbf765a50b122782c5a2/src/yolo_console_dll.cpp#L288 and look result.avi

buzdarbalooch commented 5 years ago

but isn't result.avi a video file. how it ll save result for a single image, just thinking.

buzdarbalooch commented 5 years ago

in my case its uncommented but its below. i mean is =true rather then false

bool const save_output_videofile = true;

buzdarbalooch commented 5 years ago

i tries with bool const save_output_videofile = false;. still i get this below

Screenshot 2019-04-01 13 18 43
buzdarbalooch commented 5 years ago

now another strange error, system has hanged . eg which ever command i try to excute, the system simply doesn't respond. eg. below. so i have forcefully shut the putty.

system-hang
buzdarbalooch commented 5 years ago

is it must to have here below few highlited lines must be snchronized with the weight files and cfg files?

int main(int argc, char *argv[]) { std::string names_file = "data/coco.names"; std::string cfg_file = "cfg/yolov3.cfg"; std::string weights_file = "yolov3.weights"; std::string filename;

if (argc > 4) {    //voc.names yolo-voc.cfg yolo-voc.weights test.mp4        
    names_file = argv[1];
    cfg_file = argv[2];
    weights_file = argv[3];
    filename = argv[4];
}
else if (argc > 1) filename = argv[1];

float const thresh = (argc > 5) ? std::stof(argv[5]) : 0.20;

Detector detector("cfg/yolo.cfg", "Backup/yolo_10400.weights");

auto obj_names = objects_names_from_file("data/obj1.names");
std::string out_videofile = "result.avi";
bool const save_output_videofile = true;

this part Detector detector("cfg/yolo.cfg", "Backup/yolo_10400.weights");

    **std::string  cfg_file = "cfg/yolov3.cfg";**
buzdarbalooch commented 5 years ago

hi @AlexeyAB

as u told when i try to implement tracking on an image. Here, if u notice the command i execute and the weight it loads are different , weights are loaded from the previous model i trained. see the weights the system loads Loading weights from backup/yolo_10100.weights...

akhan@tensorflow-System-Product-Name:~/darknet-master$ LD_LIBRARY_PATH=./:$LD_LIBRARY_PATH ./uselib data/obj2.names cfg/yolov2.cfg Backup1/yolov2_3700.weights experi.jpg Used GPU 0 layer filters size input output 0 conv 32 3 x 3 / 1 416 x 416 x 3 -> 416 x 416 x 32 0.299 BF 1 max 2 x 2 / 2 416 x 416 x 32 -> 208 x 208 x 32 0.006 BF 2 conv 64 3 x 3 / 1 208 x 208 x 32 -> 208 x 208 x 64 1.595 BF 3 max 2 x 2 / 2 208 x 208 x 64 -> 104 x 104 x 64 0.003 BF 4 conv 128 3 x 3 / 1 104 x 104 x 64 -> 104 x 104 x 128 1.595 BF 5 conv 64 1 x 1 / 1 104 x 104 x 128 -> 104 x 104 x 64 0.177 BF 6 conv 128 3 x 3 / 1 104 x 104 x 64 -> 104 x 104 x 128 1.595 BF 7 max 2 x 2 / 2 104 x 104 x 128 -> 52 x 52 x 128 0.001 BF 8 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BF 9 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BF 10 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BF 11 max 2 x 2 / 2 52 x 52 x 256 -> 26 x 26 x 256 0.001 BF 12 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BF 13 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BF 14 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BF 15 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BF 16 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BF 17 max 2 x 2 / 2 26 x 26 x 512 -> 13 x 13 x 512 0.000 BF 18 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BF 19 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BF 20 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BF 21 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BF 22 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BF 23 conv 1024 3 x 3 / 1 13 x 13 x1024 -> 13 x 13 x1024 3.190 BF 24 conv 1024 3 x 3 / 1 13 x 13 x1024 -> 13 x 13 x1024 3.190 BF 25 route 16 26 conv 64 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 64 0.044 BF 27 reorg / 2 26 x 26 x 64 -> 13 x 13 x 256 28 route 27 24 29 conv 1024 3 x 3 / 1 13 x 13 x1280 -> 13 x 13 x1024 3.987 BF 30 conv 45 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 45 0.016 BF 31 detection mask_scale: Using default '1.000000' Total BFLOPS 29.343 Loading weights from backup/yolo_10100.weights... seen 64 Done! input image or video filename: Time: 0.200338 sec : cannot connect to X server

buzdarbalooch commented 5 years ago

for the video also the command i execute and the weights it uploads are different. its uploading weights for the previous mode (car-parking).

akhan@tensorflow-System-Product-Name:~/darknet-master$ LD_LIBRARY_PATH=./:$LD_LIBRARY_PATH ./uselib data/obj2.names cfg/yolov2.cfg Backup1/yolov2_3700.weights cornerkick1.mov Used GPU 0 layer filters size input output 0 conv 32 3 x 3 / 1 416 x 416 x 3 -> 416 x 416 x 32 0.299 BF 1 max 2 x 2 / 2 416 x 416 x 32 -> 208 x 208 x 32 0.006 BF 2 conv 64 3 x 3 / 1 208 x 208 x 32 -> 208 x 208 x 64 1.595 BF 3 max 2 x 2 / 2 208 x 208 x 64 -> 104 x 104 x 64 0.003 BF 4 conv 128 3 x 3 / 1 104 x 104 x 64 -> 104 x 104 x 128 1.595 BF 5 conv 64 1 x 1 / 1 104 x 104 x 128 -> 104 x 104 x 64 0.177 BF 6 conv 128 3 x 3 / 1 104 x 104 x 64 -> 104 x 104 x 128 1.595 BF 7 max 2 x 2 / 2 104 x 104 x 128 -> 52 x 52 x 128 0.001 BF 8 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BF 9 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BF 10 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BF 11 max 2 x 2 / 2 52 x 52 x 256 -> 26 x 26 x 256 0.001 BF 12 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BF 13 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BF 14 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BF 15 conv 256 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 256 0.177 BF 16 conv 512 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 512 1.595 BF 17 max 2 x 2 / 2 26 x 26 x 512 -> 13 x 13 x 512 0.000 BF 18 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BF 19 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BF 20 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BF 21 conv 512 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 512 0.177 BF 22 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BF 23 conv 1024 3 x 3 / 1 13 x 13 x1024 -> 13 x 13 x1024 3.190 BF 24 conv 1024 3 x 3 / 1 13 x 13 x1024 -> 13 x 13 x1024 3.190 BF 25 route 16 26 conv 64 1 x 1 / 1 26 x 26 x 512 -> 26 x 26 x 64 0.044 BF 27 reorg / 2 26 x 26 x 64 -> 13 x 13 x 256 28 route 27 24 29 conv 1024 3 x 3 / 1 13 x 13 x1280 -> 13 x 13 x1024 3.987 BF 30 conv 45 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 45 0.016 BF 31 detection mask_scale: Using default '1.000000' Total BFLOPS 29.343 Loading weights from backup/yolo_10100.weights... seen 64 Done! input image or video filename: frame_id = 0 frame_id = 1 frame_id = 2 frame_id = 3 frame_id = 4 frame_id = 5 frame_id = 6 frame_id = 7 frame_id = 8 frame_id = 9 frame_id = 10 frame_id = 11 frame_id = 12 frame_id = 13 frame_id = 14 frame_id = 15 frame_id = 16 frame_id = 17 frame_id = 18 frame_id = 19 frame_id = 20 CUDA Error: global function call is not configured uselib: ./src/cuda.c:36: check_error: Assertion `0' failed. Aborted (core dumped)