コード例 #1
0
 def _get_next_minibatch(self):
     try:
         dataBlob, labelBlob,_  = self.iterator.next()
     except StopIteration:
         filenames = imageData.get_files(self.config.get('file_list'))
         labels = imageData.get_labels(self.config.get('file_list'))
         self.iterator = iter(self.sampleIter(filenames,labels))
         dataBlob, labelBlob,_ = self.iterator.next()
     return {'data': dataBlob, 'labels': labelBlob }  
コード例 #2
0
    def setup(self, bottom, top):
        """Setup the ResamplerDataLayer."""
        # parse the layer parameter string
        layer_config = self.param_str
	self.config = imageUtil.load_module(layer_config).config
	filenames = imageData.get_files(self.config.get('file_list'))
	labels = imageData.get_labels(self.config.get('file_list'))
	self.sampleIter = imageIterator.SharedImageIterator(self.config, deterministic=True,batch_size=self.config.get('batch_size'))
	self.iterator = iter(self.sampleIter(filenames,labels))

        self._name_to_top_map = {
            'data': 0,
            'labels': 1}

        top[0].reshape(self.config.get('batch_size'), 3, self.config.get('h'), self.config.get('w'))

        top[1].reshape(self.config.get('batch_size'))