DRNet
DRNet copied to clipboard
what is the target means in def forward(self, img, target=None)
def forward(self, img, target=None):
what does the target stand for in this function argument? Is there a sample or description? thanks
The target is a dict packaged from the annotation, you can find its specific meaning in this script dataset.py
def HT21_ImgPath_and_Target(base_path,i):
img_path = []
labels=[]
root = osp.join(base_path, i + '/img1')
img_ids = os.listdir(root)
img_ids.sort()
gts = defaultdict(list)
with open(osp.join(root.replace('img1', 'gt'), 'gt.txt'), 'r') as f:
lines = f.readlines()
for lin in lines:
lin_list = [float(i) for i in lin.rstrip().split(',')]
ind = int(lin_list[0])
gts[ind].append(lin_list)
for img_id in img_ids:
img_id = img_id.strip()
single_path = osp.join(root, img_id)
annotation = gts[int(img_id.split('.')[0])]
annotation = torch.tensor(annotation,dtype=torch.float32)
box = annotation[:,2:6]
points = box[:,0:2] + box[:,2:4]/2
sigma = torch.min(box[:,2:4], 1)[0] / 2.
ids = annotation[:,1].long()
img_path.append(single_path)
labels.append({'scene_name':i,'frame':int(img_id.split('.')[0]), 'person_id':ids, 'points':points,'sigma':sigma})
return img_path, labels