
python
Alphapeople
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
yolov8保存结果
【代码】yolov8保存结果。原创 2023-03-09 15:26:19 · 2841 阅读 · 1 评论 -
xml转yolov5
【代码】xml转yolov5。原创 2023-03-07 16:05:20 · 329 阅读 · 0 评论 -
tensorrt,rknn部署npu
将onnx读进来用C++导出trtmodel文件。原创 2023-02-24 20:56:41 · 419 阅读 · 0 评论 -
opencv滤波
x方向的soble算子在横轴方向上求梯度属于高通,在y轴方向上低通,用于去噪。拉普拉斯展示的是全局梯度。按照高斯分布进行模糊,梯度大的地方漫模糊力度大,梯度小的地方模糊力度小。作用是将断断续续的连成一片。一、平滑算子均值滤波。原创 2023-02-13 19:48:49 · 225 阅读 · 0 评论 -
仿射变换代码
import cv2。原创 2023-02-12 21:48:58 · 361 阅读 · 0 评论 -
yolov5格式转换为labelme标注格式
import osimport jsonimport cv2import base64version = '3.16.7'flags = {}lineColor = [0, 255, 0, 128]fillColor = [255, 0, 0, 128]for file in os.listdir('/media/lixuan/Data/MSCOCO/东鹏特饮/box/test'): if 'png' in file: dic = {} dic['.原创 2022-03-09 16:29:56 · 4478 阅读 · 1 评论 -
雪糕信息adasc
1:可爱多特牛乳熔岩抹茶风味冰淇淋单支装 24X115ML(71G):可爱多:和路雪(中国)有限公司:6909493100423:10652:梦龙 太妃榛子口味冰淇淋:梦龙:和路雪(中国)有限公司:6909493200505:5283:梦龙双重脆层流心酱黑巧蓝莓冰淇淋制品单支装21X88ML(72G):梦龙:和路雪(中国)有限公司:6909493100317:6004:可爱多甜筒 香草口味冰淇淋多支装Y21 6X660ML (402G):可爱多:和路雪(中国)有限公司:6909493401070:1.原创 2022-01-11 17:50:44 · 1499 阅读 · 0 评论 -
labelme解析为yolov5
import osimport jsonimport cv2for file in os.listdir('/media/lixuan/workSpace/浙江中烟130106/已知场景'): if 'bvv4nhptub0lfvhip6jg.json' in file: img = cv2.imread('/media/lixuan/workSpace/test/images/train/{}.jpg'.format(file.split('.')[0])) .原创 2022-01-11 17:34:43 · 1991 阅读 · 0 评论 -
PR、ROC曲线的绘制及AP计算
import numpy as npimport matplotlib.pyplot as pltpredicts = np.load('/home/lixuan/workspace/project/recognition/cigarette_shelve_or_not/predict.npy')#labels = np.load('/home/lixuan/workspace/project/recognition/cigarette_shelve_or_not/label.npy')#x .原创 2022-01-10 09:20:12 · 1753 阅读 · 0 评论 -
小圆元元圆
1. 已完成的意图娇子币数量打卡人数打卡次数新增用户数连续每周打卡人数打卡人数+打卡次数完美陈列次数打卡失败原因陈列不合格主要原因品牌下哪个系列陈列的最值情况陈列数据查询各省用户数量及占比省内各地市用户数量及占比成都市各区县市用户数量及占比打卡次数分布2. 访问网址http://10.0.0.19:6158/3. 示例语句娇子币数量11月发放了多少娇子币?最近30天发放多少娇子币?上周发放了多少娇子币今天发放了多少娇子币今年一共发放了多少娇子..原创 2021-12-16 15:00:13 · 154 阅读 · 0 评论 -
生成stuff
import jsonimport cv2import numpy as npf = open('/home/lixuan/下载/icecream_seg_12.6.json')for data in f.readlines(): data = data.strip() Dict = json.loads(data) content = Dict['content'] annotations = Dict['annotation'] w = annotat.原创 2021-12-14 11:30:11 · 1582 阅读 · 0 评论 -
已知COCO格式丢失了datatrucks源文件将新datatrucks加入COCO
将COCO转json:import jsonwith open('/home/lixuan/fromLX/train.json') as f: jsdict = json.load(f) images = jsdict['images'] categories = jsdict['categories'] annotations = jsdict['annotations'] print(annotations[0]) exit() imag原创 2021-12-07 11:32:58 · 234 阅读 · 0 评论 -
requests下载图片
import jsonimport osimport requestsfor file in os.listdir('../file'): f = open('../file/{}'.format(file)) for data in f.readlines(): data = data.strip() Dict = json.loads(data) content = Dict['content'] response.原创 2021-11-29 17:18:32 · 517 阅读 · 0 评论 -
实例分割中物品遮挡数据增强实现
import osimport cv2import numpy as npdef proces(img,mask): maskcopy = mask.copy() indexs = np.array(np.where(mask > 0)[:-1]) x1 = np.min(indexs[1]) y1 = np.min(indexs[0]) x2 = np.max(indexs[1]) y2 = np.max(indexs[0]) w .原创 2021-10-08 16:27:17 · 590 阅读 · 0 评论 -
根据mask获取外围点坐标
contours, hierarchy = cv2.findContours(mmask, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)原创 2021-10-08 15:51:53 · 1694 阅读 · 0 评论 -
masktococo
from convertrle import torleimport jsonimport osimport cv2import numpy as npdef xyxy2xywh(x): # Convert nx4 boxes from [x1, y1, x2, y2] to [x, y, w, h] where xy1=top-left, xy2=bottom-right y = np.zeros_like(x) y[:, 0] = (x[:, 0] + x[:, 2.原创 2021-09-01 17:47:02 · 258 阅读 · 0 评论 -
datatrucks转coco格式
import jsonimport cv2import numpy as np# with open('/media/lixuan/Data/MSCOCO/annotations_trainval2017/annotations/instances_train2017.json') as f:# datas = json.load(f)# """# info:{'description': 'COCO 2017 Dataset', 'url': 'http://coc.原创 2021-08-24 10:59:19 · 164 阅读 · 0 评论 -
datatrucks解析旋转目标
import jsonimport cv2import numpy as npimport mathdef rad(x): return x * np.pi / 180def cos_dist(a, b): if len(a) != len(b): return None part_up = 0.0 a_sq = 0.0 b_sq = 0.0 for a1, b1 in zip(a, b): part_up += a.原创 2021-08-10 15:45:35 · 162 阅读 · 0 评论 -
web项目
https://zhuanlan.zhihu.com/p/104391192原创 2021-07-28 09:48:31 · 148 阅读 · 0 评论 -
Python膨胀操作
def dilate_demo(gray): ret, binary = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY | cv2.THRESH_OTSU) kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (15, 15))#定义结构元素的形状和大小 dst = cv2.dilate(binary, kernel)#膨胀操作 return dst...原创 2021-06-22 15:33:28 · 1515 阅读 · 1 评论 -
COCO格式转yolov5训练格式
import jsonwith open('/home/lixuan/fromLX/场景识别/新场景样本/休闲细支新主题陈列/场景识别/训练样本初始数据/1_json/annotations/instances.json') as f: Json = json.load(f) annotations = Json['annotations'] images = Json['images'] image_id_name_dict = {} image_id_wid.原创 2021-06-22 11:01:29 · 1346 阅读 · 1 评论 -
Python list分片
def func(listTemp, n): for i in range(0, len(listTemp), n): yield listTemp[i:i + n]原创 2021-06-19 10:25:03 · 213 阅读 · 0 评论 -
dataturks格式转sbd格式
def getbox(cnt): rect = cv2.minAreaRect(cnt) # 得到最小外接矩形的(中心(x,y), (宽,高), 旋转角度) box = cv2.boxPoints(rect) # 获取最小外接矩形的4个顶点坐标(ps: cv2.boxPoints(rect) for OpenCV 3.x) # box = np.int(box) return [int(np.min(box[:,0])),int(np.min(box[:,1])),int(n原创 2021-06-16 09:20:17 · 190 阅读 · 0 评论 -
opencv角度旋转
def Nrotate(degrees,x,y,cx,cy): angle = degrees/180*3.1415926 nRotatex = (x-cx)*math.cos(angle) - (y-cy)*math.sin(angle) + cx nRotatey = (x-cx)*math.sin(angle) + (y-cy)*math.cos(angle) + cy return nRotatex, nRotatey原创 2021-06-07 16:46:55 · 275 阅读 · 0 评论 -
opencv获取bbox
import cv2import numpy as npimport osdef find_max_region(mask_sel): __, contours, hierarchy = cv2.findContours(mask_sel, cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE) # 找到最大区域并填充 area = [] for j in range(len(contours)): area.append(c.原创 2021-05-11 10:51:17 · 1063 阅读 · 0 评论 -
拉普拉斯图像融合数据增强
import cv2import numpy as np# import jsonfrom PIL import Imageimport osimport jsonimport randomfrom math import *count = 0def convrgba(img): threshold = 254 dist = 5 # np.asarray(img) is read only. Wrap it in np.array to make it mod.原创 2021-04-08 12:03:53 · 517 阅读 · 0 评论 -
根据mask得到矩形框
maskimg = cv2.imread('m1.png') locs = np.where(maskimg==255) x0 = np.min(locs[1]) x1 = np.max(locs[1]) y0 = np.min(locs[0]) y1 = np.max(locs[0])原创 2021-04-07 17:03:15 · 2035 阅读 · 0 评论 -
yolov5翻转数据增强
import cv2from PIL import Imageimport numpy as npimport osfor file in os.listdir('/home/lixuan/Downloads/payactions/scanandpay/images/train'): imgpath = '/home/lixuan/Downloads/payactions/scanandpay/images/train/{}'.format(file) txtpath = '/h.原创 2021-04-07 15:23:39 · 2111 阅读 · 0 评论 -
查看yolov5标注
import cv2from PIL import Imageimport numpy as npimport osfor file in os.listdir('/home/lixuan/Downloads/payactions/scanandpay/images/train'): imgpath = '/home/lixuan/Downloads/payactions/scanandpay/images/train/{}'.format(file) txtpath = '/h.原创 2021-04-07 14:59:56 · 664 阅读 · 0 评论 -
泊松融合实现无缝融合贴图数据增强
import cv2import numpy as npimport osimport jsoncount = 0def seamless(src,dst,P,center): src_mask = np.zeros(src.shape, src.dtype) poly = np.array(P, np.int32) cv2.fillPoly(src_mask, [poly], (255, 255, 255)) output = cv2.seamlessClon.原创 2021-04-07 11:02:40 · 1145 阅读 · 0 评论 -
Dataturks生成mask图片
from skimage import drawfrom skimage import ioimport numpy as npimport urllib.requestimport jsonimport loggingimport osimport sys################### INSTALLATION NOTE ############################################################################.原创 2021-04-06 16:07:13 · 248 阅读 · 0 评论 -
OpenCV根据多边形抠图
import cv2import numpy as npimport jsonP = []with open('test.json') as f: datas = f.readlines() for data in datas: data = data.strip() annotations = json.loads(data)['annotation'] annotation = annotations[0] po.原创 2021-04-01 14:59:29 · 1355 阅读 · 0 评论 -
opencv复制视频
import cv2vs = cv2.VideoCapture('/home/lixuan/桌面/cailiao/scanandpay.mp4')fourcc = cv2.VideoWriter_fourcc(*'XVID')fps = 10size = (int(vs.get(cv2.CAP_PROP_FRAME_WIDTH)), int(vs.get(cv2.CAP_PROP_FRAME_HEIGHT)))out = cv2.VideoWriter('scanandpay.mp4', fo.原创 2021-03-26 18:03:51 · 448 阅读 · 0 评论 -
解决OpenCV图片太大的问题
cv2.namedWindow('image',0)原创 2021-03-23 12:08:52 · 3773 阅读 · 1 评论 -
dataturks解析
"""根据大json写小json"""with open('pay.json') as f: datas = f.readlines() for data in datas: data = data.strip() j = json.loads(data) name = j['content'].split('/')[-1].replace('jpg','json') fw = open('drinks/{}'.form.原创 2021-03-12 17:50:06 · 557 阅读 · 0 评论 -
粘贴数据增强
# import os# from PIL import Image# import random# import cv2# import numpy as np## shopdir = '/media/lixuan/Data/sku_data/sku110k/sku110k_yolov5_style/images/train'# handdir = '/home/lixuan/Arduino/hand_detection/hand'# bank = os.listdir(shopdir).原创 2021-03-11 10:34:35 · 150 阅读 · 0 评论 -
安装pyOpenGL
sudo apt-get install python-opengl原创 2021-03-08 16:45:00 · 391 阅读 · 0 评论 -
目标检测拉近镜头数据增强
import cv2import randomimport oscount = 0for ind in range(3): for dir in os.listdir('/home/lixuan/桌面/back/coco/labels/train'): try: image = cv2.imread('/home/lixuan/桌面/back/coco/images/train/{}'.format(dir.replace('txt','jpg').原创 2021-03-03 14:42:48 · 237 阅读 · 2 评论 -
yoyov5格式转dataturks格式上传
from PIL import Imageimport osfor dir in os.listdir('/home/lixuan/Arduino/car/images'): img = Image.open(os.path.join('/home/lixuan/Arduino/car/images',dir)) img.save(os.path.join('/home/lixuan/data/t/train/data/dataset/annotations',dir)) W.原创 2021-02-20 10:21:23 · 244 阅读 · 0 评论 -
精灵标注助手解析
from PIL import Imagecount = 0for dir in os.listdir('/home/lixuan/Arduino/outputs'): path = os.path.join('/home/lixuan/Arduino/outputs',dir) f = open(path) datas = json.load(f) outputs = datas['outputs'] path = datas['path'] if o.原创 2021-02-19 15:00:53 · 754 阅读 · 0 评论