随笔分类 -  计算机视觉

图像处理。 图像分类、检测、分割、识别等。 pytorch、tensorflow。
摘要:【1】 H. Li, Z. Lin, X. Shen, J. Brandt, and G. Hua, “A convolutional neural network cascade for face detection,” in Proceedings of the IEEE conference 阅读全文
posted @ 2021-05-08 09:56 一剑光寒十四州 阅读(172) 评论(0) 推荐(0)
摘要:试一试 1 import torch 2 import torch.nn as nn 3 import torch.nn.functional as F 4 from torchsummary import summary 5 6 class ResBlock(nn.Module): 7 def _ 阅读全文
posted @ 2021-04-02 16:43 一剑光寒十四州 阅读(829) 评论(0) 推荐(0)
摘要:1 import os 2 import torch 3 from torchvision import transforms 4 from data_pipe import get_data 5 from vgg import VGG_13 6 from resnet18 import ResNe 阅读全文
posted @ 2021-04-02 16:40 一剑光寒十四州 阅读(96) 评论(0) 推荐(0)
摘要:1 #coding= utf-8 2 import os 3 import torch 4 from data_pipe import get_data 5 from model import SimpleNet 6 import numpy as np 7 import cv2 8 from PI 阅读全文
posted @ 2021-03-30 11:06 一剑光寒十四州 阅读(237) 评论(0) 推荐(0)
摘要:模型保存与加载有两种方式,本文暂时只讨论模型参数方式 1> 单GPU 保存 1 torch.save(model.state_dict(), "model.pth") 加载 1 model = SimpleNet() 2 model.load_state_dict(torch.load("./mod 阅读全文
posted @ 2021-03-30 10:36 一剑光寒十四州 阅读(116) 评论(0) 推荐(0)
摘要:1 import cv2 2 3 img_path = r"E:\tmp\tmp.jpg" 4 image = cv2.imread(img_path) 5 cv2.imshow("image", image) 6 cv2.waitKey(5000) 镜像/顺时针旋转180度 1 image1 = 阅读全文
posted @ 2021-03-25 13:31 一剑光寒十四州 阅读(208) 评论(0) 推荐(0)
摘要:图像标准化 input:输入的图像像素值 mean(input):输入图像像素的均值 std(input):输入图像像素的标准差 将原始数据映射到均值为0、标准差为1的分布上 y = (x - mean)/σ :基于原始数据的均值(mean)和标准差(standard deviation)进行数据的 阅读全文
posted @ 2021-03-24 13:48 一剑光寒十四州 阅读(1535) 评论(0) 推荐(0)
摘要:MobileNetv1模型 PyTorch自带的MobileNetV1 没有实现MobileNetV1 详情参考:https://pytorch.org/vision/stable/models.html 自己搭建 1 import torch 2 import torch.nn as nn 3 i 阅读全文
posted @ 2021-03-22 15:09 一剑光寒十四州 阅读(318) 评论(0) 推荐(0)
摘要:1、深度可分离卷积 Depthwise Separable Convolution (一)结构 实质上是将标准卷积分成了两步:depthwise卷积和pointwise卷积。 标准卷积: depthwise卷积: pointwise卷积: 2、代码实现 [32, 3, 224, 224] ——> [ 阅读全文
posted @ 2021-03-19 16:19 一剑光寒十四州 阅读(4849) 评论(0) 推荐(2)
摘要:模型搭建 0、VGG模型 1、torchvision自带的VGG模型 1 import torch 2 import torchvision 3 from torchsummary import summary 4 5 model = torchvision.models.vgg13(num_cla 阅读全文
posted @ 2021-03-18 16:32 一剑光寒十四州 阅读(442) 评论(0) 推荐(0)
摘要:1 torch.nn.Flatten(start_dim=1, end_dim=-1) Parameters 1 start_dim – first dim to flatten (default = 1). 2 end_dim – last dim to flatten (default = -1 阅读全文
posted @ 2021-03-17 15:35 一剑光寒十四州 阅读(478) 评论(0) 推荐(0)
摘要:1 torch.nn.Linear(in_features, out_features, bias=True) 用于设置网络中的全连接层。 输入与输出均是二维张量。 输入与输出形状是 [batch_size, size]。 之前一般使用view或nn.Flatten()将4维张量变为2维张量。 Pa 阅读全文
posted @ 2021-03-17 14:52 一剑光寒十四州 阅读(671) 评论(0) 推荐(0)
摘要:torch.nn.MaxPool2d(kernel_size, stride=None, padding=0, dilation=1, return_indices=False, ceil_mode=False) Parameters 1 kernel_size – the size of the 阅读全文
posted @ 2021-03-17 14:29 一剑光寒十四州 阅读(189) 评论(0) 推荐(0)
摘要:1 torch.nn.Conv2d(in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True, padding_mode='zeros') Parameters 1 in_ 阅读全文
posted @ 2021-03-16 14:57 一剑光寒十四州 阅读(133) 评论(0) 推荐(0)
摘要:序号 框架 通道顺序 1 Caffe NCHW 2 Tensorflow 默认NHWC,也支持NCHW 3 PyTorch NCHW 4 TensorRT NCHW N:batch C:channel H:height W:width 阅读全文
posted @ 2021-03-16 14:28 一剑光寒十四州 阅读(297) 评论(0) 推荐(0)
摘要:形状 1 # opencv 2 print(img.shape) (300, 400, 3) (H, W, C) 3 # PIL 4 print(img1.size) (400, 300) (W, H) 阅读全文
posted @ 2021-03-12 16:13 一剑光寒十四州 阅读(190) 评论(0) 推荐(0)
摘要:python加载图片 1. opencv加载图片 1 import cv2 2 img = cv2.imread("./cat.jpg") 2. PIL加载图片 1 from PIL import Image 2 img1 = Image.open("./cat.jpg") 序号 加载方式 模式 i 阅读全文
posted @ 2021-03-12 15:35 一剑光寒十四州 阅读(387) 评论(0) 推荐(0)