![](https://img-blog.csdnimg.cn/20190927151124774.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
深度学习 2019-2023
2019-2023的记录
骨子带刺
好记性不如烂笔头,记一记,记录自己读过的论文和跑过的代码
展开
-
如何把conda虚拟环境移到不同的机器以及soloV2安装
原来在服务器1上训练的,现在需要搬到服务器2上部署,而且服务器2还不连外网。就有了需要转移conda创建的虚拟环境的需求。1.移动conda list下面的内容conda env list得到环境的安装路径cd /home/xiaohz/anaconda3/envs把环境打包tar -cvf de2.tar de2然后把这个包移动到服务器2的conda安装环境下(conda env list查看路径),之后解压tar -xvf de.tar de2之后conda env list原创 2021-09-26 15:39:58 · 428 阅读 · 0 评论 -
1.得到文件夹下的所有文件 2.得到路径下的子文件夹 3.创建文件夹
1.得到文件夹下的所有文件2.得到路径下的子文件夹3.创建文件夹def getFiles(path): Filelist = [] for home, dirs, files in os.walk(path): for file in files: # 文件名列表,包含完整路径 file_path = os.path.join(home, file).replace('\\', '/') Filel原创 2021-10-20 15:10:43 · 99 阅读 · 0 评论 -
Python进行数据库操作
import pymysqlcon = Nonetry: #连接 mysql 的方法: connect('ip','user','password','dbname') con = pymysql.connect('ip','user','password','dbname') #所有的查询,都在连接 con 的一个模块 cursor 上面运行的 cur = con.cursor() #执行一个查询 cur.execute("SELECT VERSION(原创 2021-06-01 17:52:58 · 154 阅读 · 0 评论 -
Python查看运行内存
import psutilinfo = psutil.virtual_memory()print(u'Memory share', info.percent)if(info.percent >= 55): os.system("supervisorctl reload")打印的是内存使用百分比,大于百分之55,重启supervisorctl的进程。原创 2021-05-27 14:58:28 · 659 阅读 · 0 评论 -
基于python随机产生英文单词,句子,段落
两种方式方法1import nltkwords = 'Lorem ipsum dolor sit amet'# 自定义输入,可以随机输入一些字符串,但是结果可能就是不太好tokens = nltk.word_tokenize(words)text = nltk.Text(tokens)print(text.generate())resultamet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet ipsum dolorsit原创 2021-10-09 10:25:54 · 4401 阅读 · 6 评论 -
修改coco标注的json文件
# -*- coding:utf-8 -*-import jsondef process_json(input_json_file, output_json_file): file_in = open(input_json_file, "r") file_out = open(output_json_file, "w") # load数据到变量json_data f = json.load(file_in) for i in range(len(f['a原创 2022-05-26 14:08:15 · 478 阅读 · 0 评论 -
目标检测:swin-transformer跑通自己的数据集
使用swin-transformer训练自己的数据集原创 2022-06-06 00:00:19 · 2643 阅读 · 2 评论 -
h5文件读写和pickle文件读写 基于python
h5 写import h5pyh5f = h5py.File(path + '/' + str(name) + str(num).split('.')[0] + '_ins.h5', 'w')h5f.create_dataset('dataset_1', data=image_name)h5f.create_dataset('dataset_2', data=np.array(mask_array))h5f.close()h5 读h5f = h5py.File('D:/work/search原创 2021-11-02 15:01:47 · 806 阅读 · 0 评论 -
使用Borb创建PDF文献
默认A4大小,595x842像素,210x297mmfrom borb.pdf.document import Documentfrom borb.pdf.page.page import Pagefrom borb.pdf.canvas.layout.page_layout.multi_column_layout import SingleColumnLayout, MultiColumnLayoutfrom borb.pdf.canvas.layout.page_layout.page_layo原创 2021-10-11 15:03:54 · 844 阅读 · 0 评论 -
图像分割:把img和mask合并在一起,查看分割效果
分割任务之后总是想检查下img和mask是否匹配,我们需要把两张图放在一起看,下面就是操作。img = Image.open(file)masked_image = np.array(img).copy()# 把img和mask合并colors = random_colors(10)color = colors[6]masked_image = apply_mask(masked_image, labels_arr, color)masked_image_save = Image.from原创 2021-10-25 17:28:27 · 3745 阅读 · 2 评论 -
python求出mask的bbox坐标,mask的轮廓部分,凸包
# cols_status = np.any(image_np, axis=0)# x_index = np.where(cols_status)[0]## rows_status = np.any(image_np, axis=1)# y_index = np.where(rows_status)[0]# print(x_index[0], x_index[-1], y_index[0], y_index[-1])## top_left = (x_index[0], y_index[0])原创 2021-11-18 15:59:53 · 1894 阅读 · 2 评论 -
图像分割,标注文件COCO的JSON文件合并
主体内容是基于这个作者的,我做了修改更适合自己。https://blog.csdn.net/weixin_44151034/article/details/119321450?spm=1001.2101.3001.6650.3&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-3.no_search_link&depth_1-utm_source=distribute.pc_r原创 2021-10-27 17:59:27 · 1224 阅读 · 0 评论 -
造数据时,我想取出它的mask,图像有许多独立干扰噪点怎么办?
放大一部分像素点,如下图。一开始想的办法如下1.求连通面积,最大的那部分保留2. …后来也没有使用这种方法,我发现是我判断噪点的代码有点问题一开始是用np.whereimage = Image.open('1.png')image_np = np.array(image)#plt.imshow(image)#plt.show()image_np = np.where(np.array(image_np)==98, 0, 255)# 或者image_np = np.where(n.原创 2021-10-24 22:45:35 · 264 阅读 · 0 评论 -
SOLOv2: Dynamic and Fast Instance Segmentation
这是实例分割的方法。原创 2023-03-26 20:29:44 · 539 阅读 · 0 评论 -
DETR: End-to-End Object Detection with Transformers
DETR 将目标检测任务视为一个图像到集合(image-to-set)的问题,即给定一张图像,模型的预测结果是一个包含了所有目标的无序集合。原创 2023-03-21 16:11:49 · 233 阅读 · 0 评论 -
Detr的数据流,详细的维度信息
算法DETR:数据的流程数据的流动这里是transformer encoder的地方,包含之前的transformer dcoder,以及loss的计算,预测的输出transformer decoder的详解计算loss部分详解自定义数据结果原创 2022-06-07 18:23:19 · 389 阅读 · 2 评论 -
ubuntu安装adelaidet
conda create -n adela python=3.7source activate adela安装pytorch1.8.0conda install pytorch==1.8.0 torchvision==0.9.0 cudatoolkit=10.2 -c pytorchconda install cudnn#我是pytorch1.8.0 cuda10.2#参考https://github.com/facebookresearch/detectron2/blob/main/IN.原创 2022-03-29 13:18:35 · 2794 阅读 · 0 评论 -
脑胶质瘤的测试代码
import pandas as pdimport timeimport osfrom collections import Counterimport numpy as npimport cv2import SimpleITKfrom tqdm import tqdmdef getFiles(path): Filelist = [] for home, dirs, files in os.walk(path): for file in files:原创 2021-11-10 14:21:01 · 257 阅读 · 0 评论 -
脑胶质瘤的数据处理代码
import pandas as pdimport timeimport osfrom collections import Counterimport numpy as npimport cv2import SimpleITKfrom tqdm import tqdmimport datetimeimport jsonimport osimport reimport fnmatchfrom PIL import Imageimport numpy as npfrom pyco原创 2021-11-10 14:19:32 · 223 阅读 · 0 评论 -
2021-最新分割算法比较
BlendMask和Mask RCNNCondInst和Mask RCNNSolov2 和 Mask RCNNBoxInst和Mask RCNNCenter Mask和Mask RCNN原创 2021-10-27 13:48:35 · 744 阅读 · 0 评论 -
图像数据不足的处理方法
图像分类任务中,训练数据不足带来的问题,主要是过拟合方面。处理方法分为两类,一是基于模型的方法,包括简化模型(将非线性模型简化为线性模型),添加约束项以缩小假设空间(如L1 L2正则项),集成学习,dropout超参数等;二是基于数据的方法,1.一定程度内的随机旋转,平移,缩放,裁剪,填充,左右翻转等2.添加噪声,椒盐噪声,高斯白噪声3.颜色变换,在图像的rgb空间上进行主成分分析,得到3个主成分的特征向量和特征值,然后在rgb值上添加增量。4.改变亮度,清晰度,对比度,锐度...原创 2021-10-25 21:35:04 · 972 阅读 · 0 评论 -
特征归一化的方法
最常用的归一化方法有两种:1.线性函数归一化(min-max scaling)对原始数据进行线性变换,使结果映射到(0,1)之间。2.零均值归一化(z-score normalization)将原始数据映射到均值为0,方差为1的分布上。其中,μ、σ分别为原始数据集的均值和方法。...原创 2021-10-20 22:03:36 · 1060 阅读 · 0 评论 -
Mask-RCNN详解(1)-模型的输入
什么是Mask-RCNN它是一个实例分割框架。它可以有效地检测图像中的对象,为每个实例生成高质量的分割掩码。讲解目录分Train和Inference来分别讲解。Train分为下面几个部分输入inputsrpn网络的输入输出,实现以及loss计算ProposalLayer的输入输出,实现DetectionTargetLayer的输入输出,实现fpn_classifier_graph的输入输出,实现以及loss计算build_fpn_mask_graph的输入输出,实现以及loss计算原创 2021-07-23 14:09:53 · 1480 阅读 · 0 评论 -
深挖Mask-RCNN
Mask-RCNN原创 2021-07-22 14:18:24 · 83 阅读 · 0 评论 -
vearch-实现以图搜图
环境搭建和启动sudo docker run -it -p 8817:8817 -p 9001:9001 -p 2378:2378 -p 2390:2390 -p 2370:2370 -p 6062:6062 -p 8818:8818 -p 6061:6061 -p 8081:8081 -p 8898:8898 -p 8899:8899 -p 6060:6060 -v $PWD/config.toml:/vearch/config.toml ansj/vearch:0.3 all查看本地镜像su原创 2021-06-15 09:36:00 · 644 阅读 · 0 评论 -
推荐算法应用
推荐算法我是下载了这两个库的内容https://github.com/wubinzzu/NeuRechttps://github.com/microsoft/recommenders我的数据集只有users和items!第一次尝试MF和LightGCN熟悉https://github.com/wubinzzu/NeuRec这个代码,我只有users和items的数据集,咨询过用这两个算法比较好,应该是LightGCN的效果好些。项目目录导入配置文件NeuRec.properties和原创 2021-05-31 17:15:51 · 700 阅读 · 0 评论 -
搭建深度学习环境:Ubuntu16.04+nvidia384+cuda9+cudnn7+opencv4
历时4天,终于搭完了环境Ubuntu16.04+nvidia384+cuda9.0+cudnn7+opencv4.1.1,百度看了无数的博客,无数的问题,尝试解决无数的问题,慢慢有了一点点感觉。写一写,记一记吧,应该会有些价值。环境ubuntu16.04,是双系统(windows10+ubuntu16.04),系统已经装好的,装个虚拟机也简单。主要分了这么几个步骤:1.安装nvidia的驱...原创 2019-10-28 13:32:09 · 454 阅读 · 0 评论 -
机器学习入门(4):Ubuntu如何在Jupyter Notebook导入Tensorflow
我们先进入到tf1这个虚拟环境(1)激活环境source activate tf1(2)查看有哪些库conda listsource deactivate tf1遇到问题:ubuntu 遇到鼠标变为十字 无法点击的问题原因:我在终端输入python,然后输入import tensorflow as tf,然后打开jupyter notebook。鼠标根本就动不了!参考https:...原创 2019-08-08 10:47:41 · 625 阅读 · 0 评论 -
机器学习入门(3):Ubuntu16.04环境搭建玩TensorFlow | 100%实战
上文讲到了成功安装anaconda和pycharm。没有找到合适的支持python3.7的tensorflow,故重新下载python3.6,方法和机器学习入门(1)类似。主要内容:ubuntu16.04配置anaconda+tensorflow新手教程前提:机器学习入门(2)已经安装好了anaconda(1)直接在terminal中输入condarookie@ubuntu:~$ cond...原创 2019-08-08 10:46:29 · 517 阅读 · 0 评论 -
机器学习入门(2):Ubuntu16.04环境搭建安装Anaconda和Pycharm
1.Ubuntu上安装Anaconda在Windows上清华大学开源软件镜像站https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/下载位于最下面的Anaconda3-5.3.1-Linux-x86_64.sh,然后将Anaconda3-5.3.1-Linux-x86_64.sh拖到虚拟机Ubuntu下,打开terminal,进行到An...原创 2019-08-07 13:18:25 · 1335 阅读 · 0 评论 -
机器学习入门(1):Ubuntu16.04环境搭建安装Python3.7 | 100%实战
1.Ubuntu软件升级命令(按顺序执行)sudo apt-get updateapt list --upgradablesudo apt-get upgradesudo apt autoremove我遇到的问题:(1)sudo: vim: command not found解决方法:sudo apt-get install vim(2)E: Failed to fetch ht...原创 2019-08-06 20:54:00 · 1187 阅读 · 0 评论 -
浅谈OpenCV之角点检测的点点滴滴
开始写的时候,并不知道怎么开头,内容还是太多,就列了几个问题来自问自答一下,然后想着写一下及代码实现效果好了。什么是角点和斑点?常用的检测算法有哪些?角点检测算法在Pycharm上的实现及在Opencv4.1.0的API详解实现代码及效果什么是角点和斑点?1.角点就是极值点,即在某方面属性特别突出的点。角点是图像中一边物体的拐角或者线条之间的交叉部分,因此,图像(在两个方向)的梯度变化...原创 2019-08-05 17:05:33 · 3972 阅读 · 1 评论