bilylee / SiamFC-TensorFlow

A TensorFlow implementation of the SiamFC tracker
MIT License
358 stars 112 forks source link

code problem #62

Closed SaintLogos1234 closed 5 years ago

SaintLogos1234 commented 5 years ago

! /usr/bin/env python

-- coding: utf-8 --

#

Copyright © 2017 bily Huazhong University of Science and Technology

#

Distributed under terms of the MIT license.

"""Dataset Sampler"""

from future import absolute_import from future import division from future import print_function

import numpy as np

class Sampler(object): def init(self, data_source, shuffle=True): self.data_source = data_source self.shuffle = shuffle

def iter(self): data_idxs = np.arange(len(self.data_source)) if self.shuffle: np.random.shuffle(data_idxs)

for idx in data_idxs:
  yield idx

if name == 'main': x = [1, 2, 3] sampler = Sampler(x, shuffle=True) p = 0 for xx in sampler: print(x[xx]) p += 1 if p == 10: break I'm not sure about the function of this code. I wonder if you could tell me,thank you.

bilylee commented 5 years ago

Hi,

It means the order of videos that will be used for training. If shuffle = True, training videos are read in random order.

SaintLogos1234 commented 5 years ago

Thank you very much for your reply