Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Questions about the implementation of the getAnnotation function #5

Open
zhangquan97 opened this issue Jul 2, 2023 · 0 comments
Open

Comments

@zhangquan97
Copy link

zhangquan97 commented Jul 2, 2023

def getAnnotation(self, subset, anno):

    temporal_dict={}
    for idx in anno.keys():
        labels = anno[idx]['annotations']
        subset_vid  = anno[idx]['subset']
        num_frame = anno[idx]['feature_frame']
        vid_frame = anno[idx]['duration_frame']
        num_sec = anno[idx]['duration_second']
        corr_sec = float(num_frame) / vid_frame * num_sec
        label_list= []
        if subset in subset_vid:
            if 'unlabel' not in subset_vid:
                for j in range(len(labels)):
                    tmp_info = labels[j]
                    clip_factor = self.temporal_scale / ( corr_sec * (self.num_frame+1) )
                    action_start = tmp_info['segment'][0]*clip_factor
                    snip_start = max(min(1, tmp_info['segment'][0] / corr_sec), 0)
                    action_end = tmp_info['segment'][1]*clip_factor
                    snip_end = max(min(1, tmp_info['segment'][1] / corr_sec), 0)
                    gt_label = tmp_info["label"]
                if action_end - action_start > 1:
                    label_list.append([snip_start,snip_end,gt_label])    
        if len(label_list)>0:
            temporal_dict[idx]= {"labels":label_list,
                                "video_duration": num_sec}
    return temporal_dict

The getAnnotation() function has been used multiple times, I have questions about the following two lines of the function

                if action_end - action_start > 1:
                    label_list.append([snip_start,snip_end,gt_label])    

Should we add an indentation and enter for j in range (len (labels)): inside?

I found that this filtering operation is to delete temporal action annotations with a duration of less than 1 second. At the same time, if a video does not contain temporal action annotations with a duration of more than 1 second, the sample will be deleted. Is this implementation reasonable? Can the samples in the test set also be processed in this way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant