[python]Affine Transform

2023-11-3 写技术

import cv2 import numpy as np img = cv2.imread("book.png",1) img_org = img.copy() h,w = img.shape[:2] p1 = np.float32([[81,30],[378,80],[13,425]]) p2 = np.float32([[0,0],[300,0],[0,400]]) M = cv2.getAffineTransform(p1,p2) img = cv2.warpAffine(img,M,(w, h)) cv2.imshow("org",img_org) cv2.i...

阅读全文>>

标签: linux python

评论(0) 浏览(384)

[python]An example of argparse

2022-12-5 写技术

import argparse parser = argparse.ArgumentParser() parser.add_argument('--arg1', type=int, default=2) parser.add_argument('-arg2',type=float, default=.5) parser.add_argument('arg3',type=float) args = parser.parse_args() print(args)

阅读全文>>

标签: python

评论(0) 浏览(595)

[python]An example of with_as

2022-12-5 写技术

class newc: def __enter__(self): print("enter of newc\n") return self def __exit__(self,type,value,trace): print("exit of newc\n") print("type:", type) print("value:", value) print("trace:", trace) def fun(self): print...

阅读全文>>

标签: python

评论(0) 浏览(482)

[DL]Efficient Graph-Based Image Segmentation

2022-6-29 写技术

import os import math import torch import matplotlib.pyplot as plt from PIL import Image from torchvision import transforms from torchvision.transforms import ToPILImage MAX_VAL = 65535 means = [0.485, 0.456, 0.406] stds = [ 0.229, 0.224, 0.225] def cost_edge(a, b): ret = 0 ...

阅读全文>>

标签: neural network linux python machine_learning DL

评论(0) 浏览(943)

[Python] Create linked list in python

2022-6-22 写技术

class Node: def __init__(self, dst = -1, cost = -1): self.dst = dst self.cost = cost self.link = None def image_to_graph(image): print("ssss\n") header = Node() header.link = Node(1,1) header.link.link = Node(2,2) p = header whil...

阅读全文>>

标签: python Data Structures data_structures

评论(0) 浏览(641)

[DL]SRGAN

2022-6-9 写技术

import os import sys import torch import torch.nn as nn import torch.nn.functional as F from PIL import Image,ImageFilter import matplotlib.pyplot as plt import numpy as np import torchvision from torchvision import transforms from torchvision.transforms import ToTensor from torchvision.t...

阅读全文>>

标签: python machine_learning DL

评论(0) 浏览(557)

[DL]ESPCN

2022-6-9 写技术

import os import sys import torch import torch.nn as nn import torch.nn.functional as F from PIL import Image,ImageFilter import matplotlib.pyplot as plt import numpy as np import torchvision from torchvision import transforms from torchvision.transforms import ToTensor from torchvision.t...

阅读全文>>

标签: python machine_learning DL

评论(0) 浏览(447)

[DL]DRRN

2022-6-9 写技术

import os import sys import torch import torch.nn as nn import torch.nn.functional as F from PIL import Image,ImageFilter import matplotlib.pyplot as plt import numpy as np import torchvision from torchvision import transforms from torchvision.transforms import ToTensor from torchvision.t...

阅读全文>>

标签: python machine_learning DL

评论(0) 浏览(490)

[DL]ESRT: Transformer for Single Image Super

2022-5-31 写技术

""" Author: Nicholas Xiao Blog: log.anycle.com """ import os import sys import torch import torch.nn as nn import torch.nn.functional as F from PIL import Image,ImageFilter import matplotlib.pyplot as plt import numpy as np import torchvision from torchvision import transforms from tor...

阅读全文>>

标签: python machine_learning DL

评论(0) 浏览(508)

[DL] Transformer: Attention Is All You Need

2022-5-26 写技术

import os import sys import torch import torch.nn as nn import math from torch.autograd import Variable import spacy import random import numpy as np import torch.nn.functional as F import copy d_model = 4 opt = { "vec_dim":512, "heads":8, "N":6, "x_vocab_len":0, ...

阅读全文>>

标签: python machine_learning DL

评论(0) 浏览(462)

Powered by anycle 湘ICP备15001973号-1