Replies: 3 comments 1 reply
-
update you augmentations in DatasetMapper or remove it |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Beta Was this translation helpful? Give feedback.
1 reply
-
Append to you code:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have several medical images of type float32 (slices from nifty volumes), TIFF format. All of them are grayscale images.
First I tried to convert them into type uint8, PNG format, and train with mask r-cnn, and the result was not satisfying. In this case I want to try to train the float32 images immediately.
However, detectron2 raises error when I tried to train the float32 images.
I got
when the deault data mapper is proceeding this line of code, in detectron2/data/dataset_mapper.py, line 142 :
dataset_dict["image"] = torch.as_tensor(np.ascontiguousarray(image.transpose(2, 0, 1)))
It seems that when detectron2 is training 3-channel images, it converts the images from (H,W,C) to (C,H,W) before it transforms them into tensors.
But what for 2-channel images ? I dug in a little and find out that when detectron2 reads 2-channel uint8 images using PIL, it gives the image another default channel, in detectron2/data/detections_utils.py, line 78 :
Then I took a shortcut by just editing detections_utils.py, line 78, to let detectron2 do the same thing when dealing with float32 images : (of course it's not good to do so...)
Now I could train the float32 images, but eventually I got almost the same AP score as the uint8 ones...
Could anyone tell me whether I am doing it in the right way ? If not, what and where should I implement ?
The code below is my Train.py :
And I launch training by this command :
python Train.py --config-file ../configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_1x.yaml --num-gpus 4 SOLVER.IMS_PER_BATCH 8 SOLVER.BASE_LR 0.001 SOLVER.MAX_ITER 14130
Thanks in advance !
Beta Was this translation helpful? Give feedback.
All reactions