img_path = "/home/sz/hard_ex_segmentation/HEI-MED/data4/test/img/" label_path = "/home/sz/hard_ex_segmentation/HEI-MED/data4/test/label/" img_root = "/home/sz/hard_ex_segmentation/HEI-MED/data4/train_crop/img/" label_root = "/home/sz/hard_ex_segmentation/HEI-MED/data4/train_crop/label/" dataset = datatest.get_dataset(img_root, label_root) train_data = mx.gluon.data.DataLoader(dataset, batch_size, shuffle=True, last_batch='rollover', num_workers=8) ctx = [mx.gpu(4), mx.gpu(5), mx.gpu(6), mx.gpu(7)] net = multi_att_net.set_network() net.collect_params().reset_ctx(ctx) net.load_parameters('pretrain2_double.params', ctx=ctx) def get_batch(batch, ctx): if isinstance(batch, mx.io.DataBatch): data = batch.data[0] label = batch.data[1] else: data, label = batch return (gluon.utils.split_and_load(data, ctx), gluon.utils.split_and_load(label, ctx), data.shape[0]) loss = dice_entropy_loss.seg_loss()
import cv2 import os import random import matplotlib.pyplot as plt from mxnet import nd from mxnet import image from skimage.measure import label as la ctx1=mx.gpu(4) ctx2=mx.gpu(5) ctx3=mx.gpu(6) ctx4=mx.gpu(7) net_vessel=multi_att_net.set_network() net_vessel.collect_params().reset_ctx(ctx1) net_vessel.load_parameters("/home/sz/hard_ex_segmentation/vessel.params",ctx=ctx1) net_hard=multi_att_net.set_network() net_hard.collect_params().reset_ctx(ctx2) net_hard.load_parameters("/home/sz/hard_ex_segmentation/IDRID_HE.params",ctx=ctx2) net_mic=multi_att_net.set_network() net_mic.collect_params().reset_ctx(ctx3) net_mic.load_parameters("/home/sz/hard_ex_segmentation/micro.params",ctx=ctx3) net_heam=multi_att_net.set_network() net_heam.collect_params().reset_ctx(ctx4) net_heam.load_parameters("/home/sz/hard_ex_segmentation/heam.params",ctx=ctx4)