experiencor / keras-yolo2

Easy training on custom dataset. Various backends (MobileNet and SqueezeNet) supported. A YOLO demo to detect raccoon run entirely in brower is accessible at https://git.io/vF7vI (not on Windows).
MIT License
1.73k stars 784 forks source link

Blood Cell Detection doesn't work #359

Open Makhaon opened 6 years ago

Makhaon commented 6 years ago

I try this example (Blood Cell Detection.ipynb) with current versions of TF, Keras and Cuda on Windows.

I disabled early_stop.

This is my params:

LABELS = ['RBC']

IMAGE_H, IMAGE_W = 416, 416 GRID_H, GRID_W = 13 , 13 BOX = 5 CLASS = len(LABELS) CLASS_WEIGHTS = np.ones(CLASS, dtype='float32') OBJ_THRESHOLD = 0.3 NMS_THRESHOLD = 0.3 ANCHORS = [0.57273, 0.677385, 1.87446, 2.06253, 3.33843, 5.47434, 7.88282, 3.52778, 9.77052, 9.16828]

NO_OBJECT_SCALE = 1.0 OBJECT_SCALE = 5.0 COORD_SCALE = 1.0 CLASS_SCALE = 1.0

BATCH_SIZE = 10 WARM_UP_BATCHES = 3 TRUE_BOX_BUFFER = 50

The network trained without visible errors, but test image (BloodImage_00032) doesn't have any detected rectangle.

NextGuido commented 6 years ago

same question with you

Makhaon commented 6 years ago

I have moved to the keras-yolo3, it works fine. Thank you very much for realization!

ArkaJU commented 6 years ago

@Makhaon which implementation did you use finally to get correct results on RBC detection?

Makhaon commented 6 years ago

This one: https://github.com/experiencor/keras-yolo3

ArthurWuTW commented 6 years ago

I think norm=normalize is missing in train_batch = BatchGenerator(all_imgs[:train_valid_split], generator_config) . Both validation images and train images need to be normalized to range 0-1.

marcinbogdanski commented 5 years ago

I had problem with Blood Cell Detection.ipynb notebook as well, things I had to do to get it to work:

1) Use yolov2.weights form https://pjreddie.com/darknet/yolov2/ (YOLOv2 608x608) 2) add normalization: train_batch = BatchGenerator(all_imgs[:train_valid_split], generator_config, norm=normalize) 3) disable early stopping, because loss jumps up after training starts but then goes back to normal (??) callbacks = [checkpoint, tensorboard],

My result:

Epoch 00068: val_loss improved from 0.06367 to 0.06125, saving model to weights_blood.h5
Epoch 69/100
18/18 [==============================] - 10s 572ms/step - loss: 0.0312 - val_loss: 0.0637

Loss XY     [0.0190970376]
Loss WH     [0.0834050253]
Loss Conf   [0.00448733708]
Loss Class  [0]
Total Loss  [0.106989399]
Current Recall  [0.826815665]
Average Recall  [0.829551816]

Cells are detected correctly on test image.

zmlim commented 4 years ago

@marcinbogdanski Hi, it it possible to share the codes? I tried making the changes you pointed out, but I'm still getting errors.

WhatsApp Image 2020-03-16 at 3 31 51 PM

WhatsApp Image 2020-03-16 at 3 31 44 PM