UNeXt-pytorch
UNeXt-pytorch copied to clipboard
sigmoid(): argument 'input' (position 1) must be Tensor, not numpy.ndarray
In post_process.py
with torch.no_grad():
for input, target, meta in tqdm(val_loader, total=len(val_loader)):
input = input.cuda()
target = target.cuda()
model = model.cuda()
# compute output
if count<=5:
start = time.time()
if config['deep_supervision']:
output = model(input)[-1]
else:
output = model(input)
stop = time.time()
gput.update(stop-start, input.size(0))
start = time.time()
model = model.cpu()
input = input.cpu()
output = model(input)
stop = time.time()
cput.update(stop-start, input.size(0))
count=count+1
iou,dice = iou_score(output, target)
iou_avg_meter.update(iou, input.size(0))
dice_avg_meter.update(dice, input.size(0))
output = torch.sigmoid(output).cpu().numpy() # error
I finished the training on BUSI and no error message was reported; then I verified in post_process.py and an error was reported when count exceeded 5. I found that output is only within the range of if, which means that when count exceeds 5, it does not feed input into the model to get output, so when the statement runs to output = torch.sigmoid(output).cpu().numpy()
it generates an error?
Hello, I also encountered this problem, please do you solve it?
Hello, I also encountered the same problem, could you please solve the code?
I did not use the postprocess.py; It was from the UNET++ code base upon which this code is built on.