- 博客(46)
- 收藏
- 关注
原创 c++ 部署模型
将模型转为onnx选用pytorch框架,训练resnet18二分类,将二分类模型转为onnx模型from typing_extensions import dataclass_transformimport torchimport torch.nn as nnfrom torchvision import models, transformsimport cv2 as cvimport numpy as npfrom PIL import Imageclass_name = ['an
2022-04-27 23:14:06
2231
原创 无损图片(像素扩大)
import cv2 as cvimport osimport numpy as npdef read_img(img_path, mul, name, save_path): # 定义空列表 pix_list = [] new_img = [] img = cv.imread(img_path) # 将图片转换为灰度图 img_gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY) row, col = img_
2021-06-07 19:20:37
234
原创 VGG19代码实现以及提取特定网络层
VGG:通过使用重复的基础块,来构建深层网络。block:使用数个相同的填充为1,窗口形状大小为3的卷积层,接上一个窗口大小为2,步幅为2的最大池化。VGG19 网络结构import torchimport torch.nn as nnimport torch.nn.functional as Fclass FlattenLayer(nn.Module): def __init__(self): super(FlattenLayer, self).__init__()
2021-04-25 15:14:49
653
原创 人脸检测
采用paddlepaddle人脸识别模块接口,打开摄像头,采集图像并将人脸部分进行打码。import cv2 as cvimport paddlehub as hubimport numpy as npmask_detector = hub.Module(name="pyramidbox_lite_mobile_mask")font = cv.FONT_HERSHEY_SIMPLEXcap = cv.VideoCapture(0)if not cap.isOpened(): pri
2021-04-12 11:19:32
63
原创 更新驱动源
ubuntu驱动:sudo add-apt-repository ppa:graphics-drivers/ppasudo apt-get updatesudo apt-get install nvidia-378 nvidia-prime
2020-09-23 15:40:25
119
原创 Faster Rcnn之Resnet50
from __future__ import absolute_import # 绝对导入包from __future__ import division # 精准分割from __future__ import print_function # 解决版本兼容问题import torchimport torch.nn as nnimport torch.nn.functional as Ffrom torch.autograd import Variableimport mathimpor
2020-09-01 19:08:40
1125
原创 pytorch-线性回归
import torchfrom IPython import displayfrom matplotlib import pyplot as pltimport numpy as npimport random# generate datasetsnum_inputs = 2num_examples = 1000true_w = [2, -3.4]true_b = 3features = torch.randn(num_examples, num_inputs, dtype=to
2020-08-20 13:57:15
120
原创 蜜蜂和蚂蚁预测
from __future__ import print_function, divisionimport torchimport torch.nn as nnimport torch.optim as optimfrom torch.optim import lr_schedulerimport numpy as npimport torchvisionfrom torchvision import datasets, models, transformsimport matplotli
2020-07-29 08:49:27
190
原创 Python视频操作
import cv2 as cvimport timeimport loggingimport logging.handlersimport datetimedisplay_flag = False#init videowritersave_dir = './savevideo/'fps = 15.0frame_width = 960.0frame_height = 540.0size = (int(frame_width), int(frame_height))vw0 = cv.
2020-07-17 22:15:27
295
原创 读取xml内容,保存为json
import xml.etree.ElementTree as ETfrom os import getcwdimport jsonimport oswd = getcwd()xmlfile = wd + '\\VOCdevkit\\VOC2007\\Annotations\\'jsonfile = 'E:\\Projects\\dataset\\python\\deeplearning\\fasterrcnn\\json\\'classes = open('{}\\VOCdevkit\\t
2020-06-30 14:55:48
182
原创 将tag视频写入json文件中
''' 1、读取视频,将视频分解为帧 2、读取二维码的信息,读取id为2的二维码信息 3、将得到的坐标信息,进行透视变换'''import jsonimport apriltagimport cv2 as cvfrom myEncoder import MyEncodermp4 = cv.VideoCapture('./tag_video.mp4')detector = apriltag.Detector()i = 0jsonpath = './jsonfile/
2020-06-28 20:34:14
908
原创 摄像头拍摄视频,保存视频,并将视频保存为图片
''' 代码有两个功能:保存摄像头拍摄的视频;保存摄像头拍摄视频的图片 1、打开摄像头 2、将摄像头拍摄的视频保存 3、将摄像头拍摄的视频保存为图片注意:最后要按ESC键进行文件的保存'''import cv2 as cvimport numpy as npcap = cv.VideoCapture(0)# 写入视频操作fps = cap.get(cv.CAP_PROP_FPS)size = (int(cap.get(cv.CAP_PROP_FRAME_WI
2020-06-24 11:16:00
1238
原创 Apriltag标签透视变换
''' 1、读取视频,将视频分解为帧 2、读取二维码的信息,读取id为2的二维码信息 3、将得到的坐标信息,进行透视变换'''import jsonimport apriltagimport cv2 as cvimport numpy as npfrom myEncoder import MyEncodermp4 = cv.VideoCapture('./tag_video.mp4')fps = mp4.get(cv.CAP_PROP_FPS)size = (i
2020-06-20 13:36:59
324
原创 LENET
import syssys.path.append("/home/kesci/input")import d2lzh1981 as d2limport torchimport torch.nn as nnimport torch.optim as optimimport time#netclass Flatten(torch.nn.Module): #展平操作 def ...
2020-04-09 17:23:07
93
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人