Skip to content

Commit 19c03ce

Browse files
committed
updates
1 parent 94659aa commit 19c03ce

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/3DVL/LASO.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ class AffordQ(Dataset):
153153

154154
afford_cl = ['lay','sit','support','grasp','lift','contain','open','wrap_grasp','pour',
155155
'move','display','push','pull','listen','wear','press','cut','stab']
156-
156+
# 建立物体类型和功能类型的索引映射关系,神经网络模型只认识数字
157157
self.cls2idx = {cls.lower():np.array(i).astype(np.int64) for i, cls in enumerate(classes)}
158158
self.aff2idx = {cls:np.array(i).astype(np.int64) for i, cls in enumerate(afford_cl)}
159159
# 加载标注数据
@@ -214,18 +214,21 @@ class AffordQ(Dataset):
214214
# 对点云数据进行转置操作 ,(3,2048)
215215
point_set = point_set.transpose()
216216

217-
#
217+
# 获取当前样本对应的问题文本(训练: 随机选; 验证&测试: 固定返回问题0)
218218
question = self.find_rephrase(self.question_df, cls, affordance)
219+
# 获取当前功能类型对应的索引值
219220
affordance = self.aff2idx[affordance]
220221

222+
# 返回: 点云数据, 物体类别索引, 功能区域掩码, 问题文本, 功能类型索引
221223
return point_set, self.cls2idx[cls], gt_mask, question, affordance
222224

223225
def find_rephrase(self, df, object_name, affordance):
224226
# 如果当前是训练模式,则从问题1~15中随机选择一个问题,否则固定返回问题0
225227
qid = str(np.random.randint(1, 15)) if self.split == 'train' else '0'
226228
qid = 'Question'+qid
227-
#
229+
# 从 DataFrame df 中筛选出同时满足 物体名称匹配 和 功能属性匹配 的行,并仅保留 qid 指定的列,也就是取出上面随机选择的问题文本
228230
result = df.loc[(df['Object'] == object_name) & (df['Affordance'] == affordance), [qid]]
231+
# 问题文本不为空,则返回该问题文本
229232
if not result.empty:
230233
# return result.index[0], result.iloc[0]['Rephrase']
231234
return result.iloc[0][qid]

0 commit comments

Comments
 (0)