小编sdr*_*abb的帖子

张量流的平均平均精度(mAP)

我需要计算此问题中描述的mAP,以使用Tensorflow进行对象检测

平均精度(AP)是用于排名集的典型性能指标。AveragePrecision定义为范围S中每个真实正值TP之后精度分数的平均值。给定范围S = 7,并且有一个排名列表(增益向量)G = [1,1,0,1,1,0 ,0,1,1,0,1,0,0,..]其中1/0分别表示与相关/不相关项目相关的收益:

AP =(1/1 + 2/2 + 3/4 + 4/5)/ 4 = 0.8875。

平均平均精度(mAP):一组查询的平均精度值的平均值。

我得到了5个单热张量与预测:

prediction_A 
prediction_B
prediction_C 
prediction_D 
prediction_E 
Run Code Online (Sandbox Code Playgroud)

其中单个预测张量具有以下结构(例如prediction_A):

00100
01000
00001
00010
00010
Run Code Online (Sandbox Code Playgroud)

然后我得到了具有相同结构的正确标签(单张)张量:

y_A
y_B
y_C
y_D
y_E
Run Code Online (Sandbox Code Playgroud)

我想使用tensorflow计算mAP,因为我想总结一下,我该怎么做?

我发现了此功能, 但我无法使用它,因为我有多维矢量。

我还编写了一个计算AP的python函数,但它不使用Tensorflow

def compute_av_precision(match_list):
    n = len(match_list)
    tp_counter = 0

    cumulate_precision = 0
    for i in range(0,n):
        if match_list[i] == True:

            tp_counter …
Run Code Online (Sandbox Code Playgroud)

python tensorflow

8
推荐指数
1
解决办法
8882
查看次数

从图像numpy生成一批克隆

我有一个名为anumpy数组(一个图像),其大小如下:

[3,128,192]
Run Code Online (Sandbox Code Playgroud)

现在我想创建一个 numpy 数组,其中包含具有以下维度的a 的n 个副本:

[n,3,128,192]
Run Code Online (Sandbox Code Playgroud)

是否存在一个 numpy 函数可以在不使用循环指令的情况下帮助我解决这个问题?

python numpy

5
推荐指数
1
解决办法
1411
查看次数

Kullback-Leibler(KL)在张量流中损失

我需要在量流中最小化KL损失.

我尝试这个函数tf.contrib.distributions.kl(dist_a,dist_b,allow_nan = False,name = None)但未实现.

我尝试手动实现它:

def kl_divergence(p,q):
    return p* tf.log(p/q)+(1-p)*tf.log((1-p)/(1-q))
Run Code Online (Sandbox Code Playgroud)

是正确的?

probability loss tensorflow

4
推荐指数
1
解决办法
6249
查看次数

为什么将参数传递给 lua 类方法会变为零

我有一种方法可以从 lua 中的父列表指针构建树。特别是我有这个lua 表

parents = {2,3,13,5,12,7,11,9,10,11,12,13,14,0}
Run Code Online (Sandbox Code Playgroud)

连同两个功能:

函数 1(创建节点):

function create_node(parent, i, created, root)
  if created[i] ~= nil then
        return
  end
    print(i)
--    print(parent)
--  Create a new node and set created[i]
    local new_node = Tree()
    new_node.idx = i
    created[i] = new_node


--    If 'i' is root, change root pointer and return
    if parent[i] == 0 then
       root[1] = created[i] -- root[1] denotes root of the tree

       return
    end

--    If parent is not created, then create parent …
Run Code Online (Sandbox Code Playgroud)

lua parameter-passing

1
推荐指数
1
解决办法
707
查看次数

标签 统计

python ×2

tensorflow ×2

loss ×1

lua ×1

numpy ×1

parameter-passing ×1

probability ×1