fizyr / keras-retinanet

Keras implementation of RetinaNet object detection.
Apache License 2.0
4.38k stars 1.96k forks source link

Debug on grayscale image #1379

Closed SeaBroNoMeal closed 4 years ago

SeaBroNoMeal commented 4 years ago

Hi all, I am working on some medical gray scale images. Before, I prepared my .csv. file and ran the debug.py, it shown nothing on the screen (totally black), I assumed this was beacuse the debug tool was designed for colored images, since it did not return any error or warning message, I just assumed everything was going well and trained the network, it was fine. This days I was trying to do the data augmentations on my validation set to get more accurate result, but suddenly the mAP for my validation set during training became all zeros, I was wondering whether the problem was with my augmented validation set and want to run debug.py on it, but since I can not see whether my annotations were covered by bbox when using debug.py, how could I debug my dataset? I have tried to do some debug on my dataset by myself, and all the bounding boxes work fine. Thanks in advance!

hgaiser commented 4 years ago

It could be that your images are 16bit grayscale images, I'm not sure our code handles that kind of data properly. Surely the preprocessing of the images (which subtracts the imagenet mean of 8bit RGB images) doesn't take it into account.

SeaBroNoMeal commented 4 years ago

Hi, @hgaiser , thanks for the replying. That was also one of my concern before doing the training, but I think some of the work based on your repo also worked with 16bit medical images and achieved good results, any suggestions on how to do it? For example, will converting uint16 into float64, then feed it into network help? (I want to make sure I do not loss any information about the image)

hgaiser commented 4 years ago

I think your main issue is (assuming it loads the data without loss) to preprocess it correctly. I'm not sure what the other work did, but as I mentioned by default it subtracts the imagenet mean. If it is indeed 16bit data, then that mean might not make sense. It's hard for me to say how much this will negatively impact you results though. You could try to scale your data to 0-255, but that will surely lose information.

My best advice is to poke around in the code to see what is happening to your data and to see if your data still makes sense.

SeaBroNoMeal commented 4 years ago

Thanks a lot!