PyCIL icon indicating copy to clipboard operation
PyCIL copied to clipboard

TypeError: pic should be PIL Image or ndarray. Got <class 'torch.Tensor'>

Open kandeldeepak46 opened this issue 10 months ago • 2 comments

Hi Contributors,

I am trying to reproduce the results of SSRE and FeTrIL on tiny-imagenet-200 datasets. But getting the following TypeError.

python main.py --config=./exps/fetril.json 

These are my parameters

{
    "prefix": "train",
    "dataset": "imagenet1000",
    "memory_size": 0,
    "shuffle": true,
    "init_cls": 10,
    "increment": 20,
    "model_name": "fetril",
    "convnet_type": "resnet18",
    "device": ["2"],
    "seed": [1993],
    "init_epochs": 200,
    "init_lr" : 0.1,
    "init_weight_decay" : 5e-4,
    "epochs" : 50,
    "lr" : 0.05,
    "batch_size" : 128,
    "weight_decay" : 5e-4,
    "num_workers" : 8,
    "T" : 10
}

image

Can somebody please help to resolve this issue.

Thank you!

kandeldeepak46 avatar Apr 28 '24 18:04 kandeldeepak46

These issues are mainly due to that I specified the data preprocessing in their method file for better performance on CIFAR. For example, line 50. Deleting them should fix these issues.

G-U-N avatar Apr 29 '24 05:04 G-U-N

Thank you for your reply. Commenting on those lines worked for me.

Moreover,

Are you aware of this error? Whenever I am trying to simulate 10 tasks of 20 classes on each task as specified in the following params

{
    "prefix": "train",
    "dataset": "imagenet1000",
    "memory_size": 0,
    "shuffle": true,
    "init_cls": 10,
    "increment": 20,
    "model_name": "fetril",
    "convnet_type": "resnet18",
    "device": ["2"],
    "seed": [1993],
    "init_epochs": 200,
    "init_lr" : 0.1,
    "init_weight_decay" : 5e-4,
    "epochs" : 50,
    "lr" : 0.05,
    "batch_size" : 128,
    "weight_decay" : 5e-4,
    "num_workers" : 8,
    "T" : 10
}

image

But Whenever I used larger initial classes as

{
    "prefix": "train",
    "dataset": "imagenet1000",
    "memory_size": 0,
    "shuffle": true,
    "init_cls": 100,
    "increment": 20,
    "model_name": "fetril",
    "convnet_type": "resnet18",
    "device": ["2"],
    "seed": [1993],
    "init_epochs": 200,
    "init_lr" : 0.1,
    "init_weight_decay" : 5e-4,
    "epochs" : 50,
    "lr" : 0.05,
    "batch_size" : 128,
    "weight_decay" : 5e-4,
    "num_workers" : 8,
    "T" : 10
}

it works. Does it need to have larger initial classes? Am I missing something here? regarding the arguments of JSON file?

Thank you

kandeldeepak46 avatar Apr 29 '24 13:04 kandeldeepak46