text stringlengths 1 93.6k |
|---|
input = torch.from_numpy(image).unsqueeze(
|
0).unsqueeze(0).float().cuda()
|
net.eval()
|
with torch.no_grad():
|
out = torch.argmax(torch.softmax(net(input), dim=1), dim=1).squeeze(0)
|
prediction = out.cpu().detach().numpy()
|
metric_list = []
|
for i in range(1, classes):
|
metric_list.append(calculate_metric_percase(prediction == i, label == i))
|
if test_save_path is not None and val_or_test is True:
|
img_itk = sitk.GetImageFromArray(image.astype(np.float32))
|
prd_itk = sitk.GetImageFromArray(prediction.astype(np.float32))
|
lab_itk = sitk.GetImageFromArray(label.astype(np.float32))
|
img_itk.SetSpacing((1, 1, z_spacing))
|
prd_itk.SetSpacing((1, 1, z_spacing))
|
lab_itk.SetSpacing((1, 1, z_spacing))
|
sitk.WriteImage(prd_itk, test_save_path + '/'+case + "_pred.nii.gz")
|
sitk.WriteImage(img_itk, test_save_path + '/'+ case + "_img.nii.gz")
|
sitk.WriteImage(lab_itk, test_save_path + '/'+ case + "_gt.nii.gz")
|
# cv2.imwrite(test_save_path + '/'+case + '.png', prediction*255)
|
return metric_list
|
# <FILESEP>
|
"""
|
Compose and send recommendation emails to arxiv-sanity-lite users!
|
I run this script in a cron job to send out emails to the users with their
|
recommendations. There's a bit of copy paste code here but I expect that
|
the recommendations may become more complex in the future, so this is ok for now.
|
You'll notice that the file sendgrid_api_key.txt is not in the repo, you'd have
|
to manually register with sendgrid yourself, get an API key and put it in the file.
|
"""
|
import os
|
import time
|
import random
|
import argparse
|
import numpy as np
|
from sklearn import svm
|
import sendgrid
|
from sendgrid.helpers.mail import Email, To, Content, Mail
|
from aslite.db import load_features
|
from aslite.db import get_tags_db
|
from aslite.db import get_metas_db
|
from aslite.db import get_papers_db
|
from aslite.db import get_email_db
|
# -----------------------------------------------------------------------------
|
# the html template for the email
|
template = """
|
<!DOCTYPE HTML>
|
<html>
|
<head>
|
<style>
|
body {
|
font-family: Arial, sans-serif;
|
}
|
.s {
|
font-weight: bold;
|
margin-right: 10px;
|
}
|
.a {
|
color: #333;
|
}
|
.u {
|
font-size: 12px;
|
color: #333;
|
margin-bottom: 10px;
|
}
|
.f {
|
color: #933;
|
display: inline-block;
|
}
|
</style>
|
</head>
|
<body>
|
<br><br>
|
<div>Hi! Here are your <a href="https://arxiv-sanity-lite.com">arxiv-sanity-lite</a> recommendations. __STATS__</div>
|
<br><br>
|
<div>
|
__CONTENT__
|
</div>
|
<br><br>
|
<div>
|
To stop these emails remove your email in your <a href="https://arxiv-sanity-lite.com/profile">account</a> settings. (your account is __ACCOUNT__).
|
</div>
|
<div> <3, arxiv-sanity-lite. </div>
|
</body>
|
</html>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.