FC-DenseNet icon indicating copy to clipboard operation
FC-DenseNet copied to clipboard

Does anyone know how to use dataset_loaders ?

Open csjfwang opened this issue 7 years ago • 8 comments

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 !!

csjfwang avatar Sep 21 '17 12:09 csjfwang

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

youngfly11 avatar Sep 23 '17 07:09 youngfly11

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

csjfwang avatar Sep 27 '17 00:09 csjfwang

@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.

kuixu avatar Sep 27 '17 01:09 kuixu

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!

csjfwang avatar Sep 28 '17 07:09 csjfwang

@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()

kuixu avatar Sep 28 '17 07:09 kuixu

@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!

csjfwang avatar Sep 28 '17 08:09 csjfwang

@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'

yangguang-v avatar Sep 28 '17 08:09 yangguang-v

@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

mitrabehzadi avatar Dec 23 '17 14:12 mitrabehzadi