Computer/NN_Trainer/DataGenerator.py
def nextBatch(self,batchSize, functionOnImg=None, functionOnCmd=None):
        '''returns next batch of imgs and cmds as a np array
        :param functionOnImg: any function that can be applied on imgList data, 1 parameter which is img'''
        while True:
            if(len(self.frameletList) < batchSize*2): #check to see if get more reocrds in framelet_list
                if (self.shouldHorizontalFlip):
                    newImgCmdFrameletList = self.__fetchNewData(int(self.updateFrameletSize / 2))  # take half of data cause the other half will be from the flipped version
                    newImgCmdFrameletList.extend(self._flipHorizontal(newImgCmdFrameletList))
                else:
                    newImgCmdFrameletList = self.__fetchNewData(self.updateFrameletSize)  # get initial self.updateFrameletSize framelets
                if (self.shouldAugment):
                    newImgCmdFrameletList = self._applyAugment(newImgCmdFrameletList)
                self.frameletList.extend(newImgCmdFrameletList)

            batchList = self.__getBatch(batchSize)

            #unzip batchList into imgList and cmdList
            imgList = list(zip(*batchList))[0]
            cmdList = list(zip(*batchList))[1]

            if functionOnImg != None:
                imgList = functionOnImg(imgList)
            if functionOnCmd != None:
                cmdList = functionOnCmd(cmdList)

            yield np.array(imgList), np.array(cmdList)
returns next batch of imgs and cmds as a np array
        :param functionOnImg: any function that can be applied on imgList data, 1 parameter which is img
returns next batch of imgs and cmds as a np array
returns next batch of imgs and cmds as a np array
def nextBatch(self,batchSize, functionOnImg=None, functionOnCmd=None):
        while True:
            if(len(self.frameletList) < batchSize*2): 
                if (self.shouldHorizontalFlip):
                    newImgCmdFrameletList = self.__fetchNewData(int(self.updateFrameletSize / 2))  
                    newImgCmdFrameletList.extend(self._flipHorizontal(newImgCmdFrameletList))
                else:
                    newImgCmdFrameletList = self.__fetchNewData(self.updateFrameletSize)  
                if (self.shouldAugment):
                    newImgCmdFrameletList = self._applyAugment(newImgCmdFrameletList)
                self.frameletList.extend(newImgCmdFrameletList)
            batchList = self.__getBatch(batchSize)
            imgList = list(zip(*batchList))[0]
            cmdList = list(zip(*batchList))[1]
            if functionOnImg != None:
                imgList = functionOnImg(imgList)
            if functionOnCmd != None:
                cmdList = functionOnCmd(cmdList)
            yield np.array(imgList), np.array(cmdList)
def nextBatch ( self , batchSize , functionOnImg = None , functionOnCmd = None ) : while True : if ( len ( self . frameletList ) < batchSize * 2 ) : if ( self . shouldHorizontalFlip ) : newImgCmdFrameletList = self . __fetchNewData ( int ( self . updateFrameletSize / 2 ) ) newImgCmdFrameletList . extend ( self . _flipHorizontal ( newImgCmdFrameletList ) ) else : newImgCmdFrameletList = self . __fetchNewData ( self . updateFrameletSize ) if ( self . shouldAugment ) : newImgCmdFrameletList = self . _applyAugment ( newImgCmdFrameletList ) self . frameletList . extend ( newImgCmdFrameletList ) batchList = self . __getBatch ( batchSize ) imgList = list ( zip ( * batchList ) ) [ 0 ] cmdList = list ( zip ( * batchList ) ) [ 1 ] if functionOnImg != None : imgList = functionOnImg ( imgList ) if functionOnCmd != None : cmdList = functionOnCmd ( cmdList ) yield np . array ( imgList ) , np . array ( cmdList )
returns next batch of imgs and cmds as a np array
returns next batch of imgs and cmds as a np array
'''returns next batch of imgs and cmds as a np array
        :param functionOnImg: any function that can be applied on imgList data, 1 parameter which is img''' #check to see if get more reocrds in framelet_list # take half of data cause the other half will be from the flipped version # get initial self.updateFrameletSize framelets #unzip batchList into imgList and cmdList
self
batchSize
functionOnImg
any function that can be applied on imgList data, 1 parameter which is img
any function that can be applied on imgList data 1 parameter which is img
functionOnCmd