keras-yolo2 icon indicating copy to clipboard operation
keras-yolo2 copied to clipboard

Blood Cell Detection doesn't work

Open Makhaon opened this issue 6 years ago • 7 comments

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.

Makhaon avatar Sep 10 '18 07:09 Makhaon

same question with you

NextGuido avatar Sep 10 '18 09:09 NextGuido

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

Makhaon avatar Sep 12 '18 18:09 Makhaon

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

ArkaJU avatar Oct 11 '18 06:10 ArkaJU

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

Makhaon avatar Oct 11 '18 16:10 Makhaon

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.

ArthurWuTW avatar Oct 18 '18 07:10 ArthurWuTW

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.

marcinbogdanski avatar Apr 16 '19 11:04 marcinbogdanski

@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

zmlim avatar Mar 16 '20 07:03 zmlim