Siamese-pytorch icon indicating copy to clipboard operation
Siamese-pytorch copied to clipboard

some bug in dataloader about the self.types ?

Open Peter-weng opened this issue 3 years ago • 5 comments

hello,i meet some problem when i frist time run the code. error:

   different_c_index   = np.random.choice(range(0, self.types - 1), 1)
  File "mtrand.pyx", line 915, in numpy.random.mtrand.RandomState.choice
ValueError: 'a' cannot be empty unless no samples are taken

i think the self.types may be the size of labels,so i change the code and work for me like this,

class SiameseDataset(Dataset):
    def __init__(self, input_shape, lines, labels, random, autoaugment_flag=True):
        self.input_shape    = input_shape
        self.train_lines    = lines
        self.train_labels   = labels
        self.types          = labels.size    #  max(labels)

maybe is difficult version env make this problem?

Peter-weng avatar Jul 28 '22 09:07 Peter-weng

Your dataset format is wrong. There is a train_own_datasets parameter in train.py needs to be set.

bubbliiiing avatar Jul 28 '22 14:07 bubbliiiing

fine,i set train_own_datasets = True,which dataset format wrong? i used DDP in 8*3090 but i think it slow about dataloader,would you like to add cache image function in training like yolov5?

Peter-weng avatar Aug 02 '22 09:08 Peter-weng

Can you start training now? I set two data formats, corresponding to different data sets. The original data format corresponds to the omniglot dataset. I don't set cache, but I think you can improve num_ works.

bubbliiiing avatar Aug 05 '22 15:08 bubbliiiing

yeah, i can train now and finish the cache function,thanks for your reply

Peter-weng avatar Aug 09 '22 07:08 Peter-weng

3q

bubbliiiing avatar Aug 09 '22 15:08 bubbliiiing