Closed miscedence12 closed 1 year ago
0 means gray mode, your label file should be single channel image, and that is what gray mode image is like. If you do not set it to 0, you will have a 3 channel label image.
Which dataset are you using? Did you prepare dataset following the step in readme?
@CoinCheung,Thanks for your reply.I use the cityscapes dataset,the label has 3 channels, what should i do to change the code?
@CoinCheung Hello!I still have to bother you, I was stuck in this place for many days,I use the cityscapes dataset,but when I run the training code ,it appeared this error:
Traceback (most recent call last):
File "D:/GitHub/BiSeNet/tools/train_amp.py", line 220, in
Did you prepared dataset as the method in readme ? Are you really using the cityscapes dataset with 19 categories, or have you pre-processed it in some way?
I tried it locally, and the training status is normal. Would you please show me how you prepared the dataset?
D:/Datasets/cityscapes/leftImg8bit/train/aachen/aachen_000000_000019_leftImg8bit.png,D:/Datasets/cityscapes/gtFine/train/aachen/aachen_000000_000019_gtFine_color.png D:/Datasets/cityscapes/leftImg8bit/train/aachen/aachen_000001_000019_leftImg8bit.png,D:/Datasets/cityscapes/gtFine/train/aachen/aachen_000001_000019_gtFine_color.png D:/Datasets/cityscapes/leftImg8bit/train/aachen/aachen_000002_000019_leftImg8bit.png,D:/Datasets/cityscapes/gtFine/train/aachen/aachen_000002_000019_gtFine_color.png D:/Datasets/cityscapes/leftImg8bit/train/aachen/aachen_000003_000019_leftImg8bit.png,D:/Datasets/cityscapes/gtFine/train/aachen/aachen_000003_000019_gtFine_color.png D:/Datasets/cityscapes/leftImg8bit/train/aachen/aachen_000004_000019_leftImg8bit.png,D:/Datasets/cityscapes/gtFine/train/aachen/aachen_000004_000019_gtFine_color.png D:/Datasets/cityscapes/leftImg8bit/train/aachen/aachen_000005_000019_leftImg8bit.png,D:/Datasets/cityscapes/gtFine/train/aachen/aachen_000005_000019_gtFine_color.png D:/Datasets/cityscapes/leftImg8bit/train/aachen/aachen_000006_000019_leftImg8bit.png,D:/Datasets/cityscapes/gtFine/train/aachen/aachen_000006_000019_gtFine_color.png D:/Datasets/cityscapes/leftImg8bit/train/aachen/aachen_000007_000019_leftImg8bit.png,D:/Datasets/cityscapes/gtFine/train/aachen/aachen_000007_000019_gtFine_color.png D:/Datasets/cityscapes/leftImg8bit/train/aachen/aachen_000008_000019_leftImg8bit.png,D:/Datasets/cityscapes/gtFine/train/aachen/aachen_000008_000019_gtFine_color.png D:/Datasets/cityscapes/leftImg8bit/train/aachen/aachen_000009_000019_leftImg8bit.png,D:/Datasets/cityscapes/gtFine/train/aachen/aachen_000009_000019_gtFine_color.png D:/Datasets/cityscapes/leftImg8bit/train/aachen/aachen_000010_000019_leftImg8bit.png,D:/Datasets/cityscapes/gtFine/train/aachen/aachen_000010_000019_gtFine_color.png D:/Datasets/cityscapes/leftImg8bit/train/aachen/aachen_000011_000019_leftImg8bit.png,D:/Datasets/cityscapes/gtFine/train/aachen/aachen_000011_000019_gtFine_color.png D:/Datasets/cityscapes/leftImg8bit/train/aachen/aachen_000012_000019_leftImg8bit.png,D:/Datasets/cityscapes/gtFine/train/aachen/aachen_000012_000019_gtFine_color.png D:/Datasets/cityscapes/leftImg8bit/train/aachen/aachen_000013_000019_leftImg8bit.png,D:/Datasets/cityscapes/gtFine/train/aachen/aachen_000013_000019_gtFine_color.png D:/Datasets/cityscapes/leftImg8bit/train/aachen/aachen_000014_000019_leftImg8bit.png,D:/Datasets/cityscapes/gtFine/train/aachen/aachen_000014_000019_gtFine_color.png D:/Datasets/cityscapes/leftImg8bit/train/aachen/aachen_000015_000019_leftImg8bit.png,D:/Datasets/cityscapes/gtFine/train/aachen/aachen_000015_000019_gtFine_color.png
@CoinCheung ,this is my train.txt follwing your readme
@CoinCheung I have never change others
That is weird, did you modify the code?
@CoinCheung ,I have never change the code,but the label has 3 channels ,Is it related to this? label = cv2.imread(lbpth,0)?
Maybe you are not using the correct label file. See my anno file:
https://github.com/CoinCheung/BiSeNet/blob/befab8b643bc049b9425cb5741f9817050c1813e/datasets/cityscapes/train.txt#L2
My label file name ends with labelIdx
, but yours end with color
.
@CoinCheung Thanks for helping with this question, if I want to use label having 3 channels, what should I do to modify the code?
You cannot do this if your task is semantic segmantation. As far as I know, it is not impossible, or it is beyond my knowledge scope. If you can do this, please share your method, and I would like to learn.
@CoinCheung Thank you very much for answering my questions, I will make changes on this to complete the semantic segmentation task, and if I can achieve it, I will share my method.
@CoinCheung 你好,我能问下您当时训练bisenetv1大概训练了多久?还有训练过程中是否会有loss震荡?能否提供训练日志? 谢谢!
Close this with love&peace.
Hello@CoinCheung! I train this code but I have some questions, As follows: In base_dataset.py, when reading the label, why did you set the mode=0? def get_image(self, impth, lbpth): img = cv2.imread(impth)[:, :, ::-1].copy() label = cv2.imread(lbpth, 0)
And then, when training your code with no changes, I meet this question: IndexError: Target 119 is out of bounds.
Could you give me a hand in solving this question? Best wishes!