Skip to content

Instantly share code, notes, and snippets.

@aiwithshekhar
Last active December 14, 2019 09:24
Show Gist options
  • Save aiwithshekhar/1af9b9ded5336bb44fe4fc871c4b35cc to your computer and use it in GitHub Desktop.
Save aiwithshekhar/1af9b9ded5336bb44fe4fc871c4b35cc to your computer and use it in GitHub Desktop.
starting with all the libraries to import
# visualization library
import cv2
from matplotlib import pyplot as plt
# data storing library
import numpy as np
import pandas as pd
# torch libraries
from torch.optim.lr_scheduler import ReduceLROnPlateau
import torch
import torch.nn as nn
from torch.nn import functional as F
import torch.optim as optim
import torch.backends.cudnn as cudnn
from torch.utils.data import DataLoader, Dataset, sampler
# architecture and data split library
from sklearn.model_selection import train_test_split
import segmentation_models_pytorch as smp
# augmenation library
from albumentations import (HorizontalFlip, ShiftScaleRotate, Normalize, Resize, Compose, GaussNoise)
from albumentations.pytorch import ToTensor
# others
import os
import pdb
import time
import warnings
import random
from tqdm import tqdm_notebook as tqdm
import concurrent.futures
# warning print supression
warnings.filterwarnings("ignore")
# *****************to reproduce same results fixing the seed and hash*******************
seed = 42
random.seed(seed)
os.environ["PYTHONHASHSEED"] = str(seed)
np.random.seed(seed)
torch.cuda.manual_seed(seed)
torch.manual_seed(seed)
torch.backends.cudnn.deterministic = True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment