I am a beginner in Keras and need help to understand keras.argmax(a, axis=-1) and keras.max(a, axis=-1). What is the meaning of axis=-1 when a.shape = (19, 19, 5, 80)? And also what will be the output of keras.argmax(a, axis=-1) and keras.max(a, axis=-1)?

解决方案

This means that the index that will be returned by argmax will be taken from the last axis.

Your data has some shape (19,19,5,80). This means:

Axis 0 = 19 elements

Axis 1 = 19 elements

Axis 2 = 5 elements

Axis 3 = 80 elements

Now, negative numbers work exactly like in python lists, in numpy arrays, etc. Negative numbers represent the inverse order:

Axis -1 = 80 elements

Axis -2 = 5 elements

Axis -3 = 19 elements

Axis -4 = 19 elements

When you pass the axis parameter to the argmax function, the indices returned will be based on this axis. Your results will lose this specific axes, but keep the others.

See what shape argmax will return for each index:

K.argmax(a,axis= 0 or -4) returns (19,5,80) with values from 0 to 18

K.argmax(a,axis= 1 or -3) returns (19,5,80) with values from 0 to 18

K.argmax(a,axis= 2 or -2) returns (19,19,80) with values from 0 to 4

K.argmax(a,axis= 3 or -1) returns (19,19,5) with values from 0 to 79

pythonargmaxaxis1_keras.argmax中axis = -1的含义是什么?相关推荐

  1. Python:一文让你彻底理解numpy中axis=-1/0/1/2... [实例讲解:np.argmax(axis= -1 0 1 2) np.sum(aixs= -1 0 1 2)]

    前言 接触python有一段时间了,但总有一道坎在心中挥之不去,那就是Numpy模块中的axis=-1/0/1/2...,每每见到axis=-1.axis=0.axis=1.axis=2等操作,心中真 ...

  2. pandas中的axis=0,axis=1具体含义(转)

    第一个链接排版更好 教你轻松分清pandas中的axis=0,axis=1具体含义 第二个链接: 第一个链接是转载第二个链接的!! 原文地址

  3. Numpy学习笔记(二):argmax参数中axis=0,axis=1,axis=-1详解附代码

    文章目录 1.argmax和max函数区别 2.axis=0/axis=1/axis=-1的区别 3.具体代码分析 ---3.1一维数组 ---3.2二维数组 ---3.3三维数组 1.argmax和 ...

  4. python numpy中axis的含义_python numpy take_along_axis用法及代码示例

    通过匹配一维索引和数据切片从输入数组中获取值. 这将迭代沿索引和数据数组中沿指定轴定向的匹配1d切片,并使用前者在后者中查找值.这些切片的长度可以不同. 沿轴返回索引的函数,例如argsort和arg ...

  5. python numpy np.argmax(a, axis=None, out=None) (按给定轴位比较,返回第一个最大值索引【下标】)

    def argmax(a, axis=None, out=None):"""Returns the indices of the maximum values along ...

  6. pythonargmaxaxis1_np.argmax(input,axis)和tf.argmax(input,axis)使用

    np.argmax(input,axis)和tf.argmax(input,axis)分别是numpy和TensorFlow底下的求最大值索引的方法,用法基本一致,只有默认情况下有细微差别,以及传入的 ...

  7. tensorflow之argmax与axis

    argmax :返回矩阵中的最大索引 一维矩阵的例子: input1 = tf.constant([1.0, 2.0, 3.0]) with tf.Session() as sess:print(se ...

  8. tensorflow中axis理解非常重要

    axis的作用即如何理解 numpy是python进行科学计算必不可少的模块,随着深度学习越来越火,numpy也越来越流行.了解numpy的人知道,在numpy中,有很多的函数都涉及到axis,很多函 ...

  9. matlab 如何axis,在matlab中axis是什么意思,matlab中axis的用法

    在matlab中axis是什么意思轴在matlab中是什么意思,matlab中的Axis是指在绘图中通常使用axis函数来设置坐标值的范围,在matlab的命令窗口中输入doc轴或help轴即可获得该 ...

最新文章

  1. android设备不自带sqlite3问题(sqlite3 not found)
  2. 【精解】Exchange Server 2007群集连续复制
  3. restTemplate的介绍和使用
  4. 一篇文章了解RPC框架原理
  5. MySql某一列累计查询
  6. 租号平台正在把“未成年”变成“大人”
  7. 学习JSON的神级网站www.bejson.com
  8. 飞猪IP教你如何网络互换:电信,联通,移动网络互换
  9. 知网查重原理以及降重举例
  10. 怪物之心无法触发_《异度之刃2》稀有异刃力男怪物之心支线任务攻略
  11. Django exclude操作
  12. 什么是命令提示符、打开命令提示符、命令提示符打开浏览器某网站等操作
  13. java制作小鱼吃大鱼_Java课程设计——大鱼吃小鱼(团队)
  14. java对接七牛后台进行内容审核(鉴黄、敏感人物、暴恐)
  15. Android逐帧动画——让图片动起来
  16. 打印机共享后每天要重新连接
  17. 计算机技术与软件专业技术资格(水平)考试—— 软考中级 网络工程师笔记six
  18. matlab半实物仿真,半实物仿真系统及半实物仿真方法
  19. 在ubuntu18.04中分屏给PC显示器
  20. 根据印欧语音变规律学习英文

热门文章

  1. 深入了解Token认证的来龙去脉
  2. TensorFlow前向传播
  3. Cannot resolve xxx.5.5
  4. bilibili Saber 实时计算平台架构与实践【Apache Flink 替换 Spark Stream的架构与实践】
  5. leetcode 213. House Robber II | 213. 打家劫舍 II(Java)
  6. 【WebPack】引入Vue;认识Plugin;使用uglifyjs丑化JS代码;搭建本地服务器;生产开发环境配置文件的抽离
  7. 【Servlet】JSP学习-概念和运行原理
  8. leetcode 58. 最后一个单词的长度(C语言)
  9. css 注入,electron程序,如何在主进程远程页面中注入js及css?
  10. vivo解bl锁_mi8 8SE 小米8解帐户锁 解ID锁 解激活锁