Skip to content

Instantly share code, notes, and snippets.

@spnova12
spnova12 / psnr_debug.ipynb
Created October 31, 2018 05:05
numpy, pytorch에서의 영상 복원 실험 그리고 psnr측정과 자료형
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@spnova12
spnova12 / cuda_installation_on_ubuntu_18.04
Created September 20, 2018 01:12 — forked from Mahedi-61/cuda_11.8_installation_on_Ubuntu_22.04
cuda 9.0 complete installation procedure for ubuntu 18.04 LTS
#!/bin/bash
## This gist contains step by step instructions to install cuda v9.0 and cudnn 7.2 in ubuntu 18.04
### steps ####
# verify the system has a cuda-capable gpu
# download and install the nvidia cuda toolkit and cudnn
# setup environmental variables
# verify the installation
###
@spnova12
spnova12 / pytorch 실험 003
Last active July 12, 2018 04:46
이미지읽는 시간과 training 시간의 비교
def train_base():
start_time = 0
time_read = 0
time_read_training = 0
# training 시키지 않고 이미지 읽기만 run
for i, batch in tqdm.tqdm(enumerate(training_data_loader, 1)):
if i==1: start_time = time.time()
if i == 2000:
end_time = time.time()
@spnova12
spnova12 / pytorch 실험 002
Last active December 2, 2019 12:12
Perceptual Loss with Vgg19 and normalization
class FeatureExtractor(nn.Module):
def __init__(self, cnn, feature_layer=11):
super(FeatureExtractor, self).__init__()
self.features = nn.Sequential(*list(cnn.features.children())[:(feature_layer + 1)])
def normalize(self, tensors, mean, std):
if not torch.is_tensor(tensors):
raise TypeError('tensor is not a torch image.')
for tensor in tensors:
for t, m, s in zip(tensor, mean, std):
@spnova12
spnova12 / pytorch 실험 001
Last active July 12, 2018 04:47
Pytorch 이미지 전처리와 속도
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import torch\n",
"import numpy as np\n",