chvlyl / isic2018 Goto Github PK
View Code? Open in Web Editor NEWLesion attributes segmentation for melanoma detection with multi-task U-Net
License: MIT License
Lesion attributes segmentation for melanoma detection with multi-task U-Net
License: MIT License
Hi!
I got error while launch train.py script
Traceback (most recent call last):
File "train.py", line 394, in <module>
main()
File "train.py", line 323, in main
loss2 = F.binary_cross_entropy_with_logits(outputs_mask_ind1, train_mask_ind)
File "/nfs/home/nduginets/miniconda3/envs/with_torch/lib/python3.7/site-packages/torch/nn/functional.py", line 2980, in binary_cross_entropy_with_logits
raise ValueError("Target size ({}) must be the same as input size ({})".format(target.size(), input.size()))
ValueError: Target size (torch.Size([4, 5])) must be the same as input size (torch.Size([20]))
my command
python3 train.py --checkpoint isic_2018_checkpoint/1_multi_task_unet
--train-test-split-file /nfs/home/nduginets/ISIC2018/data/train_test_id.pickle
--image-path /mnt/tank/scratch/nduginets/task2_h5/
--batch-size 4```
Can you please provide your train_test_id.pickle, %s.h5 and %s_attribute_all.h5 files? And also say how data files and masks should be structured.
Hi,there are some errors when I test your model.pt。I don't know what I should do.can you help me?
The test code is as follows
image_path="/kaggle/input/isic2018-200-pics/ISIC2018_Task1-2_Training_Input100/"
output_path="/kaggle/working/data"
temp_path="/kaggle/working/temp"
model_weight="/kaggle/input/isicmodelunet/model.pt"
model='UNet16'
model = UNet16(num_classes=5, pretrained='vgg')
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
model.to(device)
model = nn.DataParallel(model)
state = torch.load(model_weight)
model.load_state_dict(state['model'])
print('load model weight')
image_ids = sorted([fname.split('/')[-1].split('.')[0] for fname in glob.glob(os.path.join(image_path, '*.jpg'))])
data_set = TestDataset(image_ids, image_path)
test_loader = DataLoader(data_set, batch_size=1, shuffle=False, num_workers=10, pin_memory=False)
for img_id, test_image, W, H in test_loader:
test_image = test_image.to(device) # [N, 1, H, W]
test_image = test_image.permute(0, 3, 1, 2)
outputs, outputs_mask_ind1, outputs_mask_ind2 = model(test_image)
break
the error as follows:
load model weight
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-58-cd870e1e196b> in <module>
19 test_image = test_image.to(device) # [N, 1, H, W]
20 test_image = test_image.permute(0, 3, 1, 2)
---> 21 outputs, outputs_mask_ind1, outputs_mask_ind2 = model(test_image)
22 break
23
/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py in __call__(self, *input, **kwargs)
530 result = self._slow_forward(*input, **kwargs)
531 else:
--> 532 result = self.forward(*input, **kwargs)
533 for hook in self._forward_hooks.values():
534 hook_result = hook(self, input, result)
/opt/conda/lib/python3.6/site-packages/torch/nn/parallel/data_parallel.py in forward(self, *inputs, **kwargs)
148 inputs, kwargs = self.scatter(inputs, kwargs, self.device_ids)
149 if len(self.device_ids) == 1:
--> 150 return self.module(*inputs[0], **kwargs[0])
151 replicas = self.replicate(self.module, self.device_ids[:len(inputs)])
152 outputs = self.parallel_apply(replicas, inputs, kwargs)
/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py in __call__(self, *input, **kwargs)
530 result = self._slow_forward(*input, **kwargs)
531 else:
--> 532 result = self.forward(*input, **kwargs)
533 for hook in self._forward_hooks.values():
534 hook_result = hook(self, input, result)
<ipython-input-44-863006fd5294> in forward(self, x)
65 conv2 = self.conv2(self.pool(conv1))
66 conv3 = self.conv3(self.pool(conv2))
---> 67 conv4 = self.conv4(self.pool(conv3))
68 conv5 = self.conv5(self.pool(conv4))
69 center = self.center(self.pool(conv5))
/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py in __call__(self, *input, **kwargs)
530 result = self._slow_forward(*input, **kwargs)
531 else:
--> 532 result = self.forward(*input, **kwargs)
533 for hook in self._forward_hooks.values():
534 hook_result = hook(self, input, result)
/opt/conda/lib/python3.6/site-packages/torch/nn/modules/pooling.py in forward(self, input)
139 return F.max_pool2d(input, self.kernel_size, self.stride,
140 self.padding, self.dilation, self.ceil_mode,
--> 141 self.return_indices)
142
143
/opt/conda/lib/python3.6/site-packages/torch/_jit_internal.py in fn(*args, **kwargs)
179 return if_true(*args, **kwargs)
180 else:
--> 181 return if_false(*args, **kwargs)
182
183 if if_true.__doc__ is None and if_false.__doc__ is not None:
/opt/conda/lib/python3.6/site-packages/torch/nn/functional.py in _max_pool2d(input, kernel_size, stride, padding, dilation, ceil_mode, return_indices)
486 stride = torch.jit.annotate(List[int], [])
487 return torch.max_pool2d(
--> 488 input, kernel_size, stride, padding, dilation, ceil_mode)
489
490 max_pool2d = boolean_dispatch(
RuntimeError: max_pool2d_with_indices_out_cuda_frame failed with error code 0
···
Hello, thank you for your work!
Would you please provide the pretrained model checkpoints for inference, please?
Thank you in advance, Lucía
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.