- 博客(10)
- 资源 (1)
- 收藏
- 关注
原创 AdaptiveAvgPool2d
In [1]: import torchIn [2]: a = torch.rand([4,3,4,4])In [3]: a.size()Out[3]: torch.Size([4, 3, 4, 4])In [4]: b = torch.nn.functional.adaptive_avg_pool2d(a, (1,1)) # 自适应池化,指定池化输出尺寸为 1 * 1In [5]: b.size()Out[5]: torch.Size([4, 3, 1, 1])def _ma.
2020-06-23 14:35:58 802
原创 opencv.rectangle got TypeError:tuple type
当从Image或numpy生成的图像矩阵中包含不同类型的数据时候,则会导致此问题。采用如下进行连续array,则解决此问题nps=np.ascontiguousarray(nps,dtype=np.uint8)cv2.rectangle(nps,(x1,y1),(x2,y2),(0,255,0),-1)
2020-06-19 14:47:49 178
原创 python读取c++/c
c代码:int max(int a,int b){ return a>b?a:b;}c++代码#include<iostream>using namespace std;class TestLib{ public: void display(); void display(int a); }; void TestLib::display() { cout<<"First disp
2020-06-14 18:02:51 612
原创 抽烟行为检测
总结一些与抽烟行为相关的代码:后期更新模型、数据集!参考github:1、https://github.com/AtifSarwar29/Image-fusion-for-synthetic-smoke.git2、https://github.com/xjg0124/Fire-and-Smoke-Detection.git3、https://github.com/lancezhange/smoke_recognition.git4、https://github.com/wenxingliu/s
2020-06-12 15:04:36 4406 5
转载 yolov3
一.前言近期,在研究人工智能机器视觉领域,拜读了深度学习相关资料,在练手期间比较了各前沿的网络架构,个人认为基于darknet53网络结构的yolov3以及retinanet的faster rcnn最合适深度学习工程落地的技术选型。以下是整理的对yolov3的认知解析,同时有个基于人员吸烟检测识别的小工程练手,以望沟通学习交流。后期会继续更新对faster rcnn的认知解析。二.yolov3理解you only look once.采用的是多尺度预测,类似FPN;更好的基础分类网络(类ResNet)
2020-06-12 14:59:34 337
原创 python xml
xml作为数据存储的一种格式,有着较大使用意义。1、读取xmldef xml(): tree = ET.parse(datarxml) root = tree.getroot() #r解析整个xml size = root.find('size') #root同层 w = int(size.find('width').text)#root同层 h = int(size.find('height').text)#root同层 bboxes = []
2020-06-12 14:29:44 170
原创 python json
1、loadpython json loadget=json.load(open(datarxml,'r'))2、savedump作用是对dict进行处理,之后可以进行write或者read。# 写数据with open('data.json', 'w') as f: json.dump(data, f) # 读取数据with open('data.json', 'r') as f: data = json.load(f)3、处理特殊类型Python 处理 JSON
2020-06-12 14:16:37 118
原创 Deep compression
韩松Deep compression最近用到fc层压缩,采用pytorch实现。参考文献如下:https://blog.csdn.net/weixin_36474809/article/details/80643784#%E6%84%8F%E4%B9%89
2020-06-11 14:57:56 233
原创 Pytorch模型中的parameter与buffer
Parameter 和 bufferIf you have parameters in your model, which should be saved and restored in the state_dict, but not trained by the optimizer, you should register them as buffers.Buffers won’t be returned in model.parameters(), so that the optimizer won’
2020-06-10 16:26:11 679
原创 pytorch中的Hook
pytorch中的钩子(Hook):torch.autograd.Variable.register_hooktorch.nn.Module.register_backward_hooktorch.nn.Module.register_forward_hook第一个是register_hook,是针对Variable对象的,后面的两个:register_backward_hook和register_forward_hook是针对nn.Module这个对象的。就是反向传播过程中,可以把中间量的梯度
2020-06-09 18:04:13 127
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人