parameters: (self, bottom, top)
docstring: Setup the RoIDataLayer.
docstring_summary: Setup the RoIDataLayer.
docstring_tokens: Setup the RoIDataLayer .
function: def setup(self, bottom, top):
          """Setup the RoIDataLayer."""
          self.layer_params = yaml.load(self.param_str)
          self.group_size = cfg.TRAIN.GROUPS_PER_BATCH
          self.slice_num = cfg.TRAIN.SLICE_NUM
          self.batch_size = self.group_size * self.slice_num
          # assert self.batch_size % 2 == 0, "self.batch_size must be even!"
  
          self._load_imdb(cfg.train_imdb)
          print('{:d} volume entries'.format(self.volume_num))
          self._shuffle_roidb_inds()
          self._training = self.phase == 0
  
          self.avg_img = cfg.PIXEL_MEANS
          self._iter = 0
          self.error = None
  
          self._sel_hist = np.zeros((50,))
  
          top[0].reshape(self.batch_size, 3, cfg.MAX_SIZE, cfg.MAX_SIZE)
          # top[1].reshape(self.batch_size, 1, cfg.MAX_SIZE, cfg.MAX_SIZE)
  
          if cfg.TRAIN.USE_PREFETCH:
              from multiprocessing import Process, Queue
              self._data_queue = Queue(10)
  
              def prefetch():
                  while True:
                      try:
                          # print 'begin prefetch'
                          v_inds = self._get_next_minibatch_inds()
                          ims = self._get_minibatch(v_inds)
                          self._data_queue.put(ims)
                          # print 'prefetched', v_inds, self._data_queue.qsize()
                      except Exception as e:
                          self.error = e
                          print((e.message))
                          exit(1)
  
              self._prefetch_process = Process(target=prefetch)
              self._prefetch_process.start()
  
              # Terminate the child process when the parent exists
              def cleanup():
                  print('Terminating BlobFetcher')
                  self._prefetch_process.terminate()
                  self._prefetch_process.join()
  
              import atexit
              atexit.register(cleanup)
function_tokens: def setup ( self , bottom , top ) : self . layer_params = yaml . load ( self . param_str ) self . group_size = cfg . TRAIN . GROUPS_PER_BATCH self . slice_num = cfg . TRAIN . SLICE_NUM self . batch_size = self . group_size * self . slice_num # assert self.batch_size % 2 == 0, "self.batch_size must be even!" self . _load_imdb ( cfg . train_imdb ) print ( '{:d} volume entries' . format ( self . volume_num ) ) self . _shuffle_roidb_inds ( ) self . _training = self . phase == 0 self . avg_img = cfg . PIXEL_MEANS self . _iter = 0 self . error = None self . _sel_hist = np . zeros ( ( 50 , ) ) top [ 0 ] . reshape ( self . batch_size , 3 , cfg . MAX_SIZE , cfg . MAX_SIZE ) # top[1].reshape(self.batch_size, 1, cfg.MAX_SIZE, cfg.MAX_SIZE) if cfg . TRAIN . USE_PREFETCH : from multiprocessing import Process , Queue self . _data_queue = Queue ( 10 ) def prefetch ( ) : while True : try : # print 'begin prefetch' v_inds = self . _get_next_minibatch_inds ( ) ims = self . _get_minibatch ( v_inds ) self . _data_queue . put ( ims ) # print 'prefetched', v_inds, self._data_queue.qsize() except Exception as e : self . error = e print ( ( e . message ) ) exit ( 1 ) self . _prefetch_process = Process ( target = prefetch ) self . _prefetch_process . start ( ) # Terminate the child process when the parent exists def cleanup ( ) : print ( 'Terminating BlobFetcher' ) self . _prefetch_process . terminate ( ) self . _prefetch_process . join ( ) import atexit atexit . register ( cleanup )