当前位置:网站首页>【AdaptiveAvgPool3d】pytorch教程
【AdaptiveAvgPool3d】pytorch教程
2022-07-24 15:24:00 【CV-杨帆】
目录
b站视频: https://www.bilibili.com/video/BV1va411D7Ua
1 torch.nn > AdaptiveAvgPool3d
1.1 相关资料
官方文档:https://pytorch.org/docs/stable/generated/torch.nn.AdaptiveAvgPool3d.html
参考资料:
https://runebook.dev/zh-CN/docs/pytorch/generated/torch.nn.adaptiveavgpool3d
Pytorch常用Layer深度理解:https://zhuanlan.zhihu.com/p/371167523
1.2 CLASS torch.nn.AdaptiveAvgPool3d(output_size)
Applies a 3D adaptive average pooling over an input signal composed of several input planes.
对由多个输入平面组成的输入信号进行三维自适应平均池化
The output is of size D x H x W, for any input size. The number of output features is equal to the number of input planes.
对于任何输入尺寸,输出的尺寸为D×H×W。输出特征的数量等于输入平面的数量。
1.3 Parameters 参数
output_size – the target output size of the form D x H x W. Can be a tuple (D, H, W) or a single number D for a cube D x D x D. D, H and W can be either a int, or None which means the size will be the same as that of the input.output_size –目标输出大小,格式为D x H x W。可以是元组(D,H,W),也可以是多维数据集D xD x D的单个数字D。D,H和W可以是 int 或“ None ,这意味着大小将与输入的大小相同。
1.4 Shape

我从视频流的角度来对Shape进行解释
N表示batch_size、C代表channels、D是视频流的深度、H是每帧图像的高度,W是每帧图像的宽度
视频流,每帧都是一个或RGB或灰度图,且每帧的通道数都是一样的,假设为3,对于一 个固定的视频流,其应用Conv3d的输入大小应为(1,3, d, h, w), 其中1等于batch size, 3等于输入channels, d是视频流的深度,h是每帧图像的高度,w是每帧图像的宽度。
2 测试
2.1 可视化
【腾讯文档】AdaptiveAvgPool3d:https://docs.qq.com/slide/DWGlMU0ppa1RlcVJW
2.2 平台
这个例子我在极链AI平台测试:https://cloud.videojj.com/auth/register?inviter=18452&activityChannel=student_invite

2.3 代码

import torch
import torch.nn as nn
# target output size of 5x7x9
m = nn.AdaptiveAvgPool3d((5,7,9))
input = torch.randn(5, 64, 8, 9, 10)
output = m(input)
print("input.shape:",input.shape)
print("output.shape:",output.shape)
input.shape: torch.Size([5, 64, 8, 9, 10])
output.shape: torch.Size([5, 64, 5, 7, 9])
import torch
import torch.nn as nn
# target output size of 7x7x7 (cube)
m = nn.AdaptiveAvgPool3d(7)
input = torch.randn(5, 64, 10, 9, 8)
output = m(input)
print("input.shape:",input.shape)
print("output.shape:",output.shape)
input.shape: torch.Size([5, 64, 10, 9, 8])
output.shape: torch.Size([5, 64, 7, 7, 7])
import torch
import torch.nn as nn
# target output size of 7x9x8
m = nn.AdaptiveAvgPool3d((7, None, None))
input = torch.randn(1, 64, 10, 9, 8)
output = m(input)
print("input.shape:",input.shape)
print("output.shape:",output.shape)
input.shape: torch.Size([1, 64, 10, 9, 8])
output.shape: torch.Size([1, 64, 7, 9, 8])
3 paddle关于AdaptiveAvgPool3d
官网链接:https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nn/AdaptiveAvgPool3D_cn.html
边栏推荐
- (零九)Flask有手就行——Cookie和Session
- Discussion and legitimacy of the order of entering and leaving the stack
- Outlook tutorial, how to set rules in outlook?
- 2022 RoboCom 世界机器人开发者大赛-本科组(省赛)RC-u4 攻略分队 (已完结)
- Various searches (⊙▽⊙) consolidate the chapter of promotion
- File upload and download and conversion between excel and data sheet data
- MySql函数
- 各种Normalization的直观理解
- 力扣 31.下一个排列--双指针法
- C # exit login if there is no operation
猜你喜欢

MySQL build master-slave synchronization - build with docker

Istio1.12:安装和快速入门

遭受DDoS时,高防IP和高防CDN的选择

26. Code implementation of file using disk

Summary of feature selection: filtered, wrapped, embedded

Here comes the problem! Unplug the network cable for a few seconds and plug it back in. Does the original TCP connection still exist?

2022 RoboCom 世界机器人开发者大赛-本科组(省赛)---第一题 不要浪费金币 (已完结)

华为相机能力

2022 RoboCom 世界机器人开发者大赛-本科组(省赛)-- 第三题 跑团机器人 (已完结)

You are only one SQL statement away from the tdengine Developer Conference!
随机推荐
华为相机能力
新手第一次怎么买股票 哪家证券公司开户最好最安全
Research on stability of time-delay systems based on Lambert function
Self join usage of SQL
[USENIX atc'22] an efficient distributed training framework whale that supports the super large-scale model of heterogeneous GPU clusters
[TA frost wolf \u may - hundred people plan] Figure 3.4 introduction to delayed rendering pipeline
Android section 13 detailed explanation of 03sqlite database
【TA-霜狼_may-《百人计划》】图形3.4 延迟渲染管线介绍
Sword finger offer II 001. integer division
Personal practical experience: Data Modeling "whether account data belongs to dimension or account domain"
循环结构practice
2022 RoboCom 世界机器人开发者大赛-本科组(省赛) CAIP 完整版题解
Summary of feature selection: filtered, wrapped, embedded
云开发单机版图片九宫格流量主源码
Which securities company is the best and safest to open an account? How to open an account and speculate in stocks
C - partial keyword
Sklearn.metrics module model evaluation function
MongoDB入门学习
MySql函数
DS inner row heap sort