Commit 3728851b authored by nazeerxexagen's avatar nazeerxexagen

Commit Dependencies

parent 541d2c43
......@@ -62,6 +62,99 @@
"FEATURE_PATH = 'weights/ImageSearch/Features.pt'\n",
"FEATURE_MODEL_WEIGHT_PATH = 'weights/ImageSearch/FeatureExtractorCNN.pt'"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# **Import Dependencies**"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"vscode": {
"languageId": "plaintext"
}
},
"outputs": [],
"source": [
"import os\n",
"import sys\n",
"import tqdm \n",
"import random\n",
"\n",
"import warnings\n",
"warnings.filterwarnings(\"ignore\")\n",
"\n",
"import numpy as np\n",
"from PIL import Image\n",
"from subprocess import call\n",
"import matplotlib.pyplot as plt\n",
"from collections import Counter\n",
"from sklearn.utils import shuffle, class_weight\n",
"\n",
"import torch\n",
"torch.cuda.empty_cache()\n",
"\n",
"import torchsummary \n",
"from torch import nn\n",
"from torch import optim\n",
"from torch.nn import functional as F\n",
"from torchvision import datasets, transforms, models\n",
"from torch.utils.data import DataLoader, random_split, Dataset"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"vscode": {
"languageId": "plaintext"
}
},
"outputs": [],
"source": [
"gpu_flag = torch.cuda.is_available()\n",
"device = torch.device(\"cuda:0\" if gpu_flag else \"cpu\")\n",
"\n",
"if gpu_flag:\n",
" print(\"Device Type : {}\".format(torch.cuda.get_device_name(0)))\n",
"else:\n",
" print(\"Device Type : CPU\")\n",
" \n",
"print('Python VERSION:', sys.version)\n",
"print('pyTorch VERSION:', torch.__version__)\n",
"\n",
"print('CUDNN VERSION:', torch.backends.cudnn.version())\n",
"print('Number CUDA Devices:', torch.cuda.device_count())\n",
"print('Active CUDA Device: GPU', torch.cuda.current_device())\n",
"\n",
"print ('Available devices ', torch.cuda.device_count())\n",
"print ('Current cuda device ', torch.cuda.current_device())"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"vscode": {
"languageId": "plaintext"
}
},
"outputs": [],
"source": [
"def setup_seed(seed):\n",
" np.random.seed(seed)\n",
" random.seed(seed)\n",
" torch.manual_seed(seed) # cpu\n",
" torch.cuda.manual_seed_all(seed) \n",
" torch.backends.cudnn.deterministic = True \n",
" torch.backends.cudnn.benchmark = True \n",
" \n",
"setup_seed(seed)"
]
}
],
"metadata": {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment