scott-yjyang/Vivim

Regarding to the data_polyp.py sequence loading part

Closed this issue · 1 comments

In the data loader file[data_polyp.py], it has such part that creating a sequence with certain clip_len:

for vid in vid_list:
      vid_path = os.path.join(image_root, vid)
      frms = sorted(os.listdir(vid_path),key=lambda x: int(x[:-4]))
      # print(frms)
      for idx in range(len(frms)):
          clip = []
          for ii in range(-clip_len//2+1, clip_len//2+1):
              # pick_idx = idx + ii if idx - ii < 0 else idx - ii
              pick_idx = idx+ii
              if pick_idx >= len(frms):
                  pick_idx = - 1
              if pick_idx < 0:
                  pick_idx = 0
              clip.append(os.path.join(vid_path, frms[pick_idx]))
          self.images.append(clip)
          self.gts.append([x.replace("Frame", "GT").replace("jpg","png") for x in clip])

in middle part of this code, I get a bit confused with these part:

if pick_idx >= len(frms):
    pick_idx = - 1
if pick_idx < 0:
    pick_idx = 0

with these code, if pick_idx is not in the range(0,len(frms)), it would be assigned as zero.
Are you trying to append frms[-1] if pick_idx > len(frms) or just want to append frms[0] anyways?

Thanks a lot for pointing this out!:))))
It is a typo. It should be frms[len(frms)-1].
We have updated the loading part.