资源简介
用于分类高分辨率全幻灯片图像的滑动窗框架,通常是显微镜或组织病理学图像
代码片段和文件信息
# DeepSlide
# Jason Wei Behnaz Abdollahi Saeed Hassanpour
#This splits the train val and test data.
import config
from utils import *
#main function
#note that we want the validation and test sets to be balanced
def split(all_wsi train_folder val_folder test_folder val_split test_split keep_orig_copy labels_train labels_val labels_test):
head = ‘cp‘ if keep_orig_copy else ‘mv‘ #based on whether we want to move or keep the files
#create folders
for folder in [train_folder val_folder test_folder]:
subfolders = [join(folder _class) for _class in config.classes]
for subfolder in subfolders:
confirm_output_folder(subfolder)
train_img_to_label = {}
val_img_to_label = {}
test_img_to_label = {}
#sort the images and move/copy them appropriately
subfolder_paths = get_subfolder_paths(all_wsi)
for subfolder in subfolder_paths:
image_paths = get_image_paths(subfolder)
assert len(image_paths) > val_split + test_split #make sure we have enough slides in each class
#assign training test and val images
test_idx = len(image_paths) - test_split
val_idx = test_idx - val_split
train_images = image_paths[:val_idx]
val_images = image_paths[val_idx:test_idx]
test_images = image_paths[test_idx:]
print(‘class ‘+subfolder.split(‘/‘)[-1]+ ‘:‘ ‘#train=‘+str(len(train_images)) ‘#val=‘+str(len(val_images)) ‘#test=‘+str(len(test_images)))
#move train
for train_image in train_images:
output_path = ‘/‘.join([train_folder ‘/‘.join(train_image.split(‘/‘)[1:])])
os.system(‘ ‘.join([head train_image output_path]))
img_name = train_image.split(‘/‘)[-1]
img_class = train_image.split(‘/‘)[-2]
train_img_to_label[img_name] = img_class
#writer_train.write(img_name + ‘‘ + img_class + ‘\n‘)
#move val
for val_image in val_images:
output_path = ‘/‘.join([val_folder ‘/‘.join(val_image.split(‘/‘)[1:])])
os.system(‘ ‘.join([head val_image output_path]))
img_name = val_image.split(‘/‘)[-1]
img_class = val_image.split(‘/‘)[-2]
val_img_to_label[img_name] = img_class
#writer_val.write(img_name + ‘‘ + img_class + ‘\n‘)
#move test
for test_image in test_images:
output_path = ‘/‘.join([test_folder ‘/‘.join(test_image.split(‘/‘)[1:])])
os.system(‘ ‘.join([head test_image output_path]))
img_name = test_image.split(‘/‘)[-1]
img_class = test_image.split(‘/‘)[-2]
test_img_to_label[img_name] = img_class
#writer_test.write(img_name + ‘‘ + img_class + ‘\n‘)
#for making the csv files
writer_train = open(labels_train ‘w‘)
writer_train.write(‘imggt\n‘)
for img in sorted(train_img_to_label.keys()):
writer_train.write(img + ‘‘ + train_img_to_label[img] + ‘\n‘)
writer_val = open(labels_val ‘w‘)
writer_val.write(‘imggt\n‘)
for img in sorted(val_img_to_label.keys()):
writer_val.write(img + ‘‘ + val_img_to_label[img] + ‘\n‘)
writer_test = open(labels_test ‘w‘)
writer_test.write(‘imggt\n‘)
for img in sorted(test_img_to_label.keys()):
writer_test.writ
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-07-15 21:29 deepslide-master\
文件 70 2019-07-15 21:29 deepslide-master\.gitignore
文件 35149 2019-07-15 21:29 deepslide-master\LICENSE
文件 7253 2019-07-15 21:29 deepslide-master\README.md
目录 0 2019-07-15 21:29 deepslide-master\code\
文件 3457 2019-07-15 21:29 deepslide-master\code\1_split.py
文件 895 2019-07-15 21:29 deepslide-master\code\2_process_patches.py
文件 736 2019-07-15 21:29 deepslide-master\code\3_train.py
文件 655 2019-07-15 21:29 deepslide-master\code\4_test.py
文件 430 2019-07-15 21:29 deepslide-master\code\5_grid_search.py
文件 503 2019-07-15 21:29 deepslide-master\code\6_visualize.py
文件 536 2019-07-15 21:29 deepslide-master\code\7_final_test.py
文件 4468 2019-07-15 21:29 deepslide-master\code\config.py
文件 245 2019-07-15 21:29 deepslide-master\code\run_all.sh
文件 3100 2019-07-15 21:29 deepslide-master\code\utils.py
文件 9329 2019-07-15 21:29 deepslide-master\code\utils_evaluation.py
文件 16941 2019-07-15 21:29 deepslide-master\code\utils_model.py
文件 10735 2019-07-15 21:29 deepslide-master\code\utils_processing.py
目录 0 2019-07-15 21:29 deepslide-master\code\z_preprocessing\
文件 689 2019-07-15 21:29 deepslide-master\code\z_preprocessing\1_rename_files.py
文件 3535 2019-07-15 21:29 deepslide-master\code\z_preprocessing\2_svs_to_jpg_tiles.py
文件 3224 2019-07-15 21:29 deepslide-master\code\z_preprocessing\3_repiece_jpg_tiles.py
文件 3896 2019-07-15 21:29 deepslide-master\code\z_preprocessing\4_anonymize.py
文件 1029 2019-07-15 21:29 deepslide-master\code\z_preprocessing\compress.sh
文件 2169 2019-07-15 21:29 deepslide-master\code\z_preprocessing\compress_images.py
目录 0 2019-07-15 21:29 deepslide-master\figures\
文件 1650211 2019-07-15 21:29 deepslide-master\figures\figure-2-color.jpeg
文件 6800842 2019-07-15 21:29 deepslide-master\figures\sample.jpeg
相关资源
- Python-使用MovieLens数据集训练的电影推
- Python-机器学习驱动的Web应用程序防火
- Python-subpixel利用Tensorflow的一个子像素
-
Python-汉字的神经风格转移Neuralst
y - Python-神经网络模型能够从音频演讲中
- Python-深度增强学习算法的PyTorch实现策
- Python-基于深度学习的语音增强使用
- Python-基于知识图谱的红楼梦人物关系
- Python-STGAN用于图像合成的空间变换生
- Python-利用GAN进行图片填充
- Python-基于50W携程出行攻略的顺承事件
- Python-在TensorFlow中实现实现图像卷积网
- Python-60DaysRLChallenge中文版强化学习6
- Python-一个非常简单的BiLSTMCRF模型用于
- Python-Tensorflow仿AlphaGo框架实现的AI围棋
- Python-我是小诗姬全唐诗作为训练数据
- Python-用于物体跟踪的全卷积连体网络
- Python-数学建模竞赛中所使用的相关算
- Python-MonoDepthPyTorchPyTorch无监督单目深
- Python-用Tensorflowjs实现的可回收非可回
- Python-利用TensorFlow中的深度学习进行图
- Python-TensorFlow快速入门与实战课件与参
- Python-FCN完全卷积网络中最简单最容易
- Python-匈牙利算法卡尔曼滤波器多目标
- Python-mathAI一个拍照做题程序输入一张
- Python-Tensorflow实现SpatialAsDeepSpatialCNN
- Python-图像分类目标检测姿态估计分割
- Python-用python3opencv3做的中国车牌识别
- Python-各种对抗神经网络GAN大合集
- Python-Intel开源增强学习框架Coach
评论
共有 条评论