![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
code
cv_lz
图像算法工程师
展开
-
python根据txt文件中的路径把相应图片移到新文件夹中(YOLO)
# -*- coding: utf-8 -*-import shutilimport osdef objFileName(): local_file_name_list = "/export/liuzhe/program/detection/yolov5_distill/VOCdevkit/VOC2007/val.txt" obj_name_list = [] for i in open(local_file_name_list, 'r'): o...原创 2022-01-24 01:20:52 · 3754 阅读 · 0 评论 -
pytorch网络m参数量、flops计算方法
# 1from thop import profilex = torch.randn(1, 3, 256, 256)flops, params = profile(self.modelG, inputs=(x,))print('flops is %.2fM' % (flops/1e6)) ## 打印计算量print('params is %.2fM' % (params/1e6)) ## 打印参数量# 2num = 0for param in self.modelG.paramet.原创 2021-09-02 22:13:50 · 1251 阅读 · 0 评论 -
pytorch读数据并做裁剪、翻转、旋转等操作
from os import listdirfrom os.path import joinfrom torch.utils.data import Datasetimport torchvision.transforms as transformsfrom PIL import Image, ImageFilterimport numpy as npimport torchimport cv2import osimport randomimport torch.nn.funct.原创 2021-03-24 21:11:40 · 1548 阅读 · 0 评论 -
python批量读取图片处理并保存
import cv2 as cvimport matplotlib.pyplot as pltimport numpy as npimport numpy as npimport cv2import osimport math# 图像灰度延展、直方图均衡化file_root = 'E:/program/sxdevice2/SRCNN_en/data/train/lr/' # 当前文件夹下的所有图片file_list = os.listdir(file_root)save_out.原创 2021-03-24 17:54:52 · 8367 阅读 · 2 评论 -
plt将tensorboard几张loss图合为一张的代码
import matplotlib.pyplot as pltimport matplotlib as mplimport numpy as npfrom matplotlib.font_manager import FontPropertiesimport csv'''读取csv文件'''def readcsv(files): csvfile = open(files, 'r') plots = csv.reader(csvfile, delimiter=',') .原创 2020-12-05 13:49:17 · 2529 阅读 · 2 评论 -
python代码:jpeg图像转jpg图像
from PIL import Imagedef jpeg2jpg(path_in, path_out): img = Image.open(path_in) img.save(path_out, "JPEG", quality=80, optimize=True, progressive=True)path1 = "/export/liuzhe/program2/PyTorch-GAN-master/data/FLIR/train/a/"path2 = "/export/li.原创 2020-10-09 17:53:30 · 3274 阅读 · 0 评论