[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) 浏览(665)

[DL]VDSR:Super-resolution with VDSR

2022-4-28 写技术

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 DL

评论(0) 浏览(811)

[python]Some anaconda commands

2022-3-12 写技术

conda create --name opencv python=3.9 conda info -e source activate opencv

阅读全文>>

标签: python

评论(1) 浏览(1639)

[python]Edit excel by xlrd and xlwt

2021-8-26 写技术

import xlrd import xlwt def edit_excel(fromFile, fromSheet): w_workbook = xlwt.Workbook() w_sheet = w_workbook.add_sheet("nicholas", cell_overwrite_ok=True) workbook = xlrd.open_workbook(fromFile) print(workbook.sheet_names()) sheet = workbook.sheet_names()[fromShe...

阅读全文>>

标签: python

评论(0) 浏览(1065)

[python]Read excel by xlrd

2021-8-26 写技术

import xlrd def read_excel(fromFile, fromSheet): workbook = xlrd.open_workbook(fromFile) print(workbook.sheet_names()) sheet = workbook.sheet_names()[fromSheet] sheet = workbook.sheet_by_index(fromSheet) print(sheet) row = sheet.nrows col = sheet.ncols ...

阅读全文>>

标签: python

评论(0) 浏览(1010)

[python]An example of get web page by selenium

2021-8-17 写技术

from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.common.key...

阅读全文>>

标签: python

评论(0) 浏览(933)

[python]Display image with matplot

2021-5-27 写技术

import matplotlib.pyplot as plt #plt.figure() img = plt.imread(image_path) plt.imshow(img) plt.show()

阅读全文>>

标签: python

评论(0) 浏览(1173)

[python]Python to read directorys and write sheet (excel)

2021-5-20 写技术

import os import xlwt def file_name(file_dir): for root, dirs, files in os.walk(file_dir): list_files(files) def list_files(files): workbook = xlwt.Workbook(encoding = 'utf-8') worksheet = workbook.add_sheet('Nicholas') lines = 1 for item in files: ...

阅读全文>>

标签: python

评论(0) 浏览(1079)

[python]Gather all URLs from a certain web

2019-12-12 写技术

# encoding=utf8 import sys reload(sys) sys.setdefaultencoding('utf8') import urllib from bs4 import BeautifulSoup import urlparse import time import urllib2 url = "http://log.anycle.com" domain = "log.anycle.com" deep = 0 tmp = "" sites = set() visited = set() #local = set() ...

阅读全文>>

标签: python

评论(0) 浏览(1247)

[python]下标切片

2016-6-14 写技术

':'切片 Python下标是以0开始的 x[1:3]表示返回集合中下标1至3(不包括3)的元素集合 x[:3] 表示返回从开始到下标3(不包括3)的元素集合 x[3:]表示返回从下标3到结束的元素集合 即返回从开始下标到结束下标之间的集合(不包括结束下标)

阅读全文>>

标签: python

评论(0) 浏览(1513)

Powered by anycle 湘ICP备15001973号-1