chaoyuaw / pytorch-coviar

Compressed Video Action Recognition
https://www.cs.utexas.edu/~cywu/projects/coviar/
GNU Lesser General Public License v2.1
502 stars 126 forks source link

Why the value n in dataset.py function get_seg_range is subtracted 1 twice? #70

Open TyroneLi opened 5 years ago

TyroneLi commented 5 years ago

Hi~I am confused about this operation as I mention in title.Inside dataset.py function get_seg_range, n is subtracted 1 twice.could u make some more expression details?Thanks ``def get_seg_range(n, num_segments, seg, representation): if representation in ['residual', 'mv']: n -= 1 seg_size = float(n - 1) / num_segments seg_begin = int(np.round(seg_size seg)) seg_end = int(np.round(seg_size (seg+1))) if seg_end == seg_begin: seg_end = seg_begin + 1

if representation in ['residual', 'mv']:
    # Exclude the 0-th frame, because it's an I-frmae.
    return seg_begin + 1, seg_end + 1

return seg_begin, seg_end``