contextnet/utils/datasets.py
def make(self):
        """
        Iter throught dataset and save all features to the output dir.
        """
        self._make_dir(self.output_dir)
        
        for i in range(self.k):
            self._make_dir(os.path.join(self.output_dir, str(i)))
            self._make_dir(os.path.join(self.output_dir, str(i), self.images_dir))
            self._make_dir(os.path.join(self.output_dir, str(i), self.keypoints_dir))
            self._make_dir(os.path.join(self.output_dir, str(i), self.heatmaps_dir))

        for index in tqdm(range(len(self.dataset))):
            self.indexes.add(index)
            for i in range(self.k):
                data = self.dataset[index]
                image = data['image']
                keypoints = data['keypoints']
                heatmaps = data['heatmaps']
                
                torch.save(image, f'{os.path.join(self.output_dir, str(i), self.images_dir, str(index))}.pt')
                np.save(f'{os.path.join(self.output_dir, str(i), self.keypoints_dir, str(index))}.npy', keypoints)
                torch.save(heatmaps, f'{os.path.join(self.output_dir, str(i), self.heatmaps_dir, str(index))}.pt')

        with open(f'{os.path.join(self.output_dir, self.data_name)}.txt', 'w') as data_file:
            for index in self.indexes:
                data_file.write(f'{index}\n')

        Iter throught dataset and save all features to the output dir.
        
Iter throught dataset and save all features to the output dir.
Iter throught dataset and save all features to the output dir .
def make(self):
        self._make_dir(self.output_dir)
        for i in range(self.k):
            self._make_dir(os.path.join(self.output_dir, str(i)))
            self._make_dir(os.path.join(self.output_dir, str(i), self.images_dir))
            self._make_dir(os.path.join(self.output_dir, str(i), self.keypoints_dir))
            self._make_dir(os.path.join(self.output_dir, str(i), self.heatmaps_dir))
        for index in tqdm(range(len(self.dataset))):
            self.indexes.add(index)
            for i in range(self.k):
                data = self.dataset[index]
                image = data['image']
                keypoints = data['keypoints']
                heatmaps = data['heatmaps']
                torch.save(image, f'{os.path.join(self.output_dir, str(i), self.images_dir, str(index))}.pt')
                np.save(f'{os.path.join(self.output_dir, str(i), self.keypoints_dir, str(index))}.npy', keypoints)
                torch.save(heatmaps, f'{os.path.join(self.output_dir, str(i), self.heatmaps_dir, str(index))}.pt')
        with open(f'{os.path.join(self.output_dir, self.data_name)}.txt', 'w') as data_file:
            for index in self.indexes:
                data_file.write(f'{index}\n')
def make ( self ) : self . _make_dir ( self . output_dir ) for i in range ( self . k ) : self . _make_dir ( os . path . join ( self . output_dir , str ( i ) ) ) self . _make_dir ( os . path . join ( self . output_dir , str ( i ) , self . images_dir ) ) self . _make_dir ( os . path . join ( self . output_dir , str ( i ) , self . keypoints_dir ) ) self . _make_dir ( os . path . join ( self . output_dir , str ( i ) , self . heatmaps_dir ) ) for index in tqdm ( range ( len ( self . dataset ) ) ) : self . indexes . add ( index ) for i in range ( self . k ) : data = self . dataset [ index ] image = data [ 'image' ] keypoints = data [ 'keypoints' ] heatmaps = data [ 'heatmaps' ] torch . save ( image , f'{os.path.join(self.output_dir, str(i), self.images_dir, str(index))}.pt' ) np . save ( f'{os.path.join(self.output_dir, str(i), self.keypoints_dir, str(index))}.npy' , keypoints ) torch . save ( heatmaps , f'{os.path.join(self.output_dir, str(i), self.heatmaps_dir, str(index))}.pt' ) with open ( f'{os.path.join(self.output_dir, self.data_name)}.txt' , 'w' ) as data_file : for index in self . indexes : data_file . write ( f'{index}\n' )
Iter throught dataset and save all features to the output dir.
Iter throught dataset and save all features to the output dir .
"""
        Iter throught dataset and save all features to the output dir.
        """
self