This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
model = mt_models.Unet(drop_rate=0.4, bn_momentum=0.1) | |
model.cuda() | |
num_epochs = 10 | |
initial_lr = 0.001 | |
optimizer = optim.Adam(model.parameters(), lr=initial_lr) | |
scheduler = optim.lr_scheduler.CosineAnnealingLR(optimizer, num_epochs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def numeric_score(prediction, groundtruth): | |
FP = np.float(np.sum((prediction == 1) & (groundtruth == 0))) | |
FN = np.float(np.sum((prediction == 0) & (groundtruth == 1))) | |
TP = np.float(np.sum((prediction == 1) & (groundtruth == 1))) | |
TN = np.float(np.sum((prediction == 0) & (groundtruth == 0))) | |
return FP, FN, TP, TN | |
def accuracy(prediction, groundtruth): | |
FP, FN, TP, TN = numeric_score(prediction, groundtruth) | |
N = FP + FN + TP + TN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import argparse | |
import numpy as np | |
import mxnet as mx | |
import gluonnlp as nlp | |
import tvm | |
from tvm import relay | |
import tvm.contrib.graph_runtime as runtime | |
def timer(thunk, repeat=1, number=10, dryrun=3, min_repeat_ms=1000): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import argparse | |
import numpy as np | |
import mxnet as mx | |
import gluonnlp as nlp | |
import tvm | |
from tvm import relay | |
import tvm.contrib.graph_runtime as runtime | |
def timer(thunk, repeat=1, number=10, dryrun=3, min_repeat_ms=1000): |