Skip to content

tok_k 函数理解 #18

Description

@caiya55

您好:
我在读代码中的tok_k函数的时候发现:

def top_k(heat,k=100):
    batch,h,w,c=heat.get_shape().as_list()
    heat=tf.reshape(heat,(batch,-1))
    k_value,k_index=tf.nn.top_k(heat,k)
    k_class=k_index//(h*w)
    k_position=k_index%(h*w)
    k_y=k_position//w#0 is also a cata
    k_x=k_position%w
    return k_value,k_position,k_class,k_y,k_x

这里c在最后一个维度的话,得到k_index之后再反推出k_class 时候感觉不是很对。我自己尝试发现channel维度在h和w之前这么算才是对的。请问有人能告诉我怎么理解比较对呢

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions