training;TypeError: 'Image' object is not subscriptable
[rank0]: File "/home/gyd/miniconda3/envs/pytorch/lib/python3.9/site-packages/torch/utils/data/_utils/fetch.py", line 55, in fetch
[rank0]: return self.collate_fn(data)
[rank0]: File "/home/gyd/DEIM-main/engine/data/dataloader.py", line 181, in call
[rank0]: images = torch.cat([x[0][None] for x in items], dim=0)
[rank0]: File "/home/gyd/DEIM-main/engine/data/dataloader.py", line 181, in
@MercerLuo the problem come from your images x[0] is a PIL.Image not a torch tensor.
The solution is in the config file.yaml you must include dataloader.yaml which apply transform methods. For examples, I start using the python scripts
model=m
CUDA_VISIBLE_DEVICES=0,1 torchrun --master_port=7777 --nproc_per_node=2 train.py \
-c configs/deim_dfine/deim_hgnetv2_${model}_coco.yml \
--use-amp \
--seed=0 \
-t weights/deim_dfine_hgnetv2_m_coco_90e.pth
here is my deim_hgnetv2_m_coco.yml
__include__: [
'./dfine_hgnetv2_m_coco.yml',
'../base/deim.yml',
'../dataset/custom_detection.yml',
'../base/dataloader.yml',
'../base/optimizer.yml',
'../runtime.yml',
]
output_dir: ./outputs/deim_hgnetv2_m_gender
. . .
@MercerLuo the problem come from your images
x[0]is a PIL.Image not a torch tensor.The solution is in the config file.yaml you must include
dataloader.yamlwhich applytransformmethods. For examples, I start using the python scriptsmodel=m CUDA_VISIBLE_DEVICES=0,1 torchrun --master_port=7777 --nproc_per_node=2 train.py
-c configs/deim_dfine/deim_hgnetv2_${model}_coco.yml
--use-amp
--seed=0
-t weights/deim_dfine_hgnetv2_m_coco_90e.pth here is mydeim_hgnetv2_m_coco.ymlinclude: [ './dfine_hgnetv2_m_coco.yml', '../base/deim.yml', '../dataset/custom_detection.yml', '../base/dataloader.yml', '../base/optimizer.yml', '../runtime.yml', ]
output_dir: ./outputs/deim_hgnetv2_m_gender . . .
My questions is what't the function of 'dataloader.yaml'?