We start with the imports:
import dicom
import os
import numpy
The
pydicompackage can be installed throughpipand can be found in https://pypi.python.org/pypi/pydicom/
| import keras | |
| from keras.models import Sequential | |
| from keras.models import load_model | |
| from keras.layers import Dense | |
| from keras.optimizers import Adam | |
| import numpy as np | |
| import random | |
| from collections import deque |
| # -*- coding: utf-8 -*- | |
| from __future__ import print_function | |
| import os | |
| import sys | |
| import argparse | |
| import tqdm | |
| import tensorflow as tf |
| #!/bin/bash | |
| # install CUDA Toolkit v9.0 | |
| # instructions from https://developer.nvidia.com/cuda-downloads (linux -> x86_64 -> Ubuntu -> 16.04 -> deb) | |
| CUDA_REPO_PKG="cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb" | |
| wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/${CUDA_REPO_PKG} | |
| sudo dpkg -i ${CUDA_REPO_PKG} | |
| sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub | |
| sudo apt-get update | |
| sudo apt-get -y install cuda-9-0 |
| import io | |
| import os | |
| import numpy as np | |
| from PIL import Image | |
| from pymongo import MongoClient | |
| from torch.utils.data import Dataset, DataLoader | |
| from torchvision import transforms | |
| def pil_loader(f): |
| import torch | |
| import torchvision as tv | |
| class ImagesDataset(torch.utils.data.Dataset): | |
| def __init__(self, df, transform=None, | |
| loader=tv.datasets.folder.default_loader): | |
| self.df = df | |
| self.transform = transform | |
| self.loader = loader |
| import torch | |
| import torch.nn as nn | |
| import numpy as np | |
| import torch.optim as optim | |
| from torch.autograd import Variable | |
| # (1, 0) => target labels 0+2 | |
| # (0, 1) => target labels 1 | |
| # (1, 1) => target labels 3 | |
| train = [] |
| """ | |
| Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy) | |
| BSD License | |
| """ | |
| import numpy as np | |
| # data I/O | |
| data = open('input.txt', 'r').read() # should be simple plain text file | |
| chars = list(set(data)) | |
| data_size, vocab_size = len(data), len(chars) |
We start with the imports:
import dicom
import os
import numpy
The
pydicompackage can be installed throughpipand can be found in https://pypi.python.org/pypi/pydicom/
| #!/usr/local/bin/python | |
| ####################################################### | |
| # Otsu's Method | |
| # Author: Samuel Jackson (samueljackson@outlook.com) | |
| # Date: 21/07/2013 | |
| # Description: Performs Otsu's method of thresholding | |
| # using the between class variance. | |
| ####################################################### |