SimJeg / FC-DenseNet

Fully Convolutional DenseNets for semantic segmentation.
488 stars 146 forks source link

Does anyone know how to use dataset_loaders ? #23

Open csjfwang opened 6 years ago

csjfwang commented 6 years ago

Hello ,

I want to ask if anyone know how to use dataset_loaders (https://github.com/fvisin/dataset_loaders) in this FC-DenseNet code. I want to train FC-DenseNet , but i failed to use that dataset_loaders. Hope someone can help me...

Thanks a lot !!

youngfly11 commented 6 years ago

You can writh it youself directly. But you need to download the dataset in the SegNet project.

csjfwang commented 6 years ago

@youngfly11 Ok, i'll try it. thx!

kuixu commented 6 years ago

@youngfly11 I have done some modification on the training code(train.py). After I installed fvisin/dataset_loaders, I just changed the code at line 28. Change

        X, Y = iterator.next()

into

        xsubset, xraw_data, Y, X, xfilenames = iterator.next().values()

You could try it, hopes this would help you a lot.

=== updated sorry, it's

xsubset, xraw_data, Y,X, xfilenames = iterator.next().values()

The Y is in front of X.

csjfwang commented 6 years ago

hi @barrykui , Thanks for your help! I'm trying with your advice and i have modified the code in train.py ,but now i have a new problem when i use the command as following,

THEANO_FLAGS='device=cuda,optimizer=fast_compile,optimizer_including=fusion' python train.py -c config/FC-DenseNet103.py -e experiment_name

It shows the following error,

Traceback (most recent call last):
  File "train.py", line 261, in <module>
    initiate_training(cf)
  File "train.py", line 229, in initiate_training
    train(cf)
  File "train.py", line 76, in train
    n_classes = train_iter.get_n_classes()
AttributeError: 'CamvidDataset' object has no attribute 'get_n_classes'

Is there other code that i should modify? Thanks a ton!

kuixu commented 6 years ago

@wlwsea , Sorry, I just update the code that I presented above. The correct one is :

xsubset, xraw_data, Y, X, xfilenames = iterator.next().values()

not

xsubset, xraw_data, X, Y, xfilenames = iterator.next().values()
csjfwang commented 6 years ago

@barrykui , Thank you! I just changed the code as you said, xsubset, xraw_data, Y,X, xfilenames = iterator.next().values() But, there is still the problem as i asked you,

Loading data
Unknown arguments: ['get_01c', 'seq_per_video', 'horizontal_flip', 'get_one_hot', 'crop_size']
Unknown arguments: ['save_to_dir', 'seq_per_video', 'get_01c', 'get_one_hot', 'crop_size']
Unknown arguments: ['save_to_dir', 'seq_per_video', 'get_01c', 'get_one_hot', 'crop_size']
Traceback (most recent call last):
  File "train.py", line 261, in <module>
    initiate_training(cf)
  File "train.py", line 229, in initiate_training
    train(cf)
  File "train.py", line 76, in train
    n_classes = train_iter.get_n_classes()
AttributeError: 'CamvidDataset' object has no attribute 'get_n_classes'

I really confused about it. Do you know the reason of that? Thanks a lot!

yangguang-v commented 6 years ago

@barrykui , Thank you very much! I have just changed the code as you said, xsubset, xraw_data, Y , X, xfilenames = iterator.next().values() But, when I use the command as following,

THEANO_FLAGS='device=cuda,optimizer=fast_compile,optimizer_including=fusion' python train.py -c config/FC-DenseNet103.py -e experiment_name

I have a new problem,

It shows the following error:

Loading data
Unknown arguments: ['get_01c', 'seq_per_video', 'horizontal_flip', 'get_one_hot', 'crop_size']
Unknown arguments: ['save_to_dir', 'seq_per_video', 'get_01c', 'get_one_hot', 'crop_size']
Unknown arguments: ['save_to_dir', 'seq_per_video', 'get_01c', 'get_one_hot', 'crop_size']
Traceback (most recent call last):
  File "train.py", line 256, in <module>
    initiate_training(cf)
  File "train.py", line 224, in initiate_training
    train(cf)
  File "train.py", line 71, in train
    n_classes = train_iter.get_n_classes()
AttributeError: 'CamvidDataset' object has no attribute 'get_n_classes'
mitrabehzadi commented 6 years ago

@yangguang-v I encountered the same error I solved it by adding the functions get_n_classes() to CamvidDataset functions my self like bellow:

def get_n_classes(self):
    return self.non_void_nclasses

you should also add get_void_labels() and get_n_batches() functions