Python
Deeachain
这个作者很懒,什么都没留下…
展开
-
南信大iNUIST校园网自动登录代码
南京信息工程大学校园网自动登录python代码登录网站http://a.nuist.edu.cn/python3自动运行代码修改的登录类型和账号、密码即可# !/usr/bin/python# --*-- coding:utf-8 --*--import requests import base64import osimport timeclass nuist_login(): def __init__(self): self.ping_result =原创 2021-01-22 12:20:11 · 6554 阅读 · 9 评论 -
opencv批量化图片叠加
# coding=utf-8import cv2from glob import globlabels = glob('*label.png')for i, label in enumerate(labels): image_name = labels[i].split('label')[0] img_a = cv2.imread(image_name + '.png') img_b = cv2.imread(label) res = cv2.addWeighte原创 2021-01-19 21:02:37 · 693 阅读 · 0 评论 -
pip导出项目依赖包
# 安装pip install pipreqs# 在当前目录生成pipreqs . --encoding=utf8 --force原创 2020-09-13 12:16:35 · 397 阅读 · 0 评论 -
Pycharm设置代码署名
自定义Pycharm署名# _*_ coding: utf-8 _*_"""Time: ${DATE} ${TIME}Author: Cheng Ding(Deeachain)Version: V 0.1File: ${NAME}.pyDescribe: Write during the internship at Hikvison, Github link: https://github.com/Deeachain/GraphEmbeddings"""效果.原创 2020-09-09 18:19:14 · 3165 阅读 · 0 评论 -
Python极速实现单通道图片改变像素值
直接上代码示例链接:https://pan.baidu.com/s/19zR1LSxxElkMlotZq5dnfA 提取码:8888iimport osimport cv2import numpy as npfrom glob import globfrom tqdm import tqdm"""input:单通道图片,每个像素点是用一个三位数表示output:将三位数的像素表达改变成一位数"""root_dir = 'train/labels' # 存储图片的root目录pic原创 2020-08-28 19:18:22 · 937 阅读 · 0 评论 -
读取csv文件,逐行写入txt
import csv #加载csv包便于读取csv文件x, y = [], []csv_file = open('G:/竞赛/datafountain/O2O商铺食品安全相关评论发现/rnn_cnn/data/train.csv',encoding='utf-8') #打开csv文件next(csv_file)csv_reader_lines = csv.reader(csv_file) #逐行读取csv文件for one_line in csv_reader_lines:原创 2020-06-30 21:47:01 · 991 阅读 · 0 评论 -
np.argmax&torch.max()对比
argmax函数np.argmax()通俗来说:在axis的增长方向上求最大值np.argmax()import numpy as npa = np.array([ [ [1, 5, 5, 2], [9, -6, 2, 8], [-3, 7, -9, 1] ], [ [-原创 2020-06-27 12:59:44 · 1460 阅读 · 0 评论 -
Numpy打印数组中的全部元素
在print之前添加np.set_printoptions(threshold=np.inf) #将数组的元素全部打印出来原创 2020-06-27 12:58:42 · 5325 阅读 · 0 评论 -
两种NER数据集读取
'''处理数据集'''# with open('train_data.txt', 'r') as f:# train_x = f.readlines()# with open('train_label.txt', 'r') as f:# train_y = f.readlines()## with open('data.txt', 'w') as f:# for index_x, x in enumerate(train_x):# for index_原创 2020-06-27 12:29:14 · 664 阅读 · 0 评论 -
将自己顶点坐标的txt文件的bbox框显示在图片上
'''用的是自己生成的顶点坐标的txt文件'''import cv2image = cv2.imread('./COCO_val2014_000000250282.jpg')f = open('./val2014顶点坐标/COCO_val2014_000000250282.txt')for bbox in f.readlines(): id, x1, y1, x2, y2 = int(bbox.split(' ')[0]), int(bbox.split(' ')[1]), int(bbo原创 2020-06-27 12:25:12 · 545 阅读 · 1 评论 -
Python计算文本余弦相似度
#!/usr/bin/python3import kashgarifrom kashgari.embeddings import BERTEmbeddingimport loggingimport numpy as npfrom sklearn.metrics.pairwise import cosine_similarityimport jiebaimport syschinese_bert_file='./data/chinese_L-12_H-768_A-12'def cal_c原创 2020-06-27 12:24:31 · 2557 阅读 · 0 评论 -
Python批量更改txt文本每行数据
# with open('./5k.txt') as f:# lines = f.readlines() # 整行读取f = open('./trainvalno5k.txt')lines = f.readlines() # 整行读取f.close()for line in lines: rs = line.rstrip('\n') # 去除原来每行后面的换行符,但有可能是\r或\r\n newname = rs.replace(rs, '.原创 2020-06-27 12:22:29 · 3529 阅读 · 0 评论 -
Python格式化输出时间
from time import strftime, localtimedate = strftime("%Y-%m-%d %H:%M:%S", localtime())print(date)输出结果2020-01-03 17:50:42原创 2020-06-27 12:21:04 · 198 阅读 · 0 评论