Computer/NN_Trainer/DataGenerator.py
def __fetchNewData(self, size):
        '''Adds elements to self.framelet_list as the discrete turns cmds'''
        frameCount = 0;
        newImgCmdFrameletList = []
        while frameCount < size:
            self.cursor.execute("""SELECT * FROM {0} WHERE Id=?""".format(self.table), self.rowIdList[self.rowIdIndex])
            row = self.cursor.fetchone()

            framelet_list = pickle.loads(row.ImageByteArray) #get the framelet_list
            shuffle(framelet_list)
            if(self.trainType.value == TrainType.DiscreteTurns.value):
                for framelet in framelet_list:
                    if (framelet.cmd[0:4] != Commands.NO_CMD.value[0:4] and framelet.cmd[0:4] != Commands.STOP_ALL_MOTORS.value[0:4]):
                        img = framelet.frame
                        # img = self.__normalizeData(img)
                        img = normalizeData(img, self.normalizationMethod)
                        if (self.shouldReshapeImg):
                            img = img.reshape(-1)
                        newImgCmdFrameletList.append((img, framelet.cmd[0:4]))
                        frameCount +=1
            elif(self.trainType.value == TrainType.SteerAngles.value): #cmds are steering angles
                for framelet in framelet_list:
                    img = framelet.frame
                    img = normalizeData(img, self.normalizationMethod)
                    if (self.shouldReshapeImg):
                        img = img.reshape(-1)
                    newImgCmdFrameletList.append((img, framelet.steerDegree))
                    frameCount +=1
            else:
                msg = "Unknown trainType. trainType is of type TrainType. Your value is : {}".format(self.trainType.name)
                raise ValueError(msg)
            # frameCount += row.FrameCount
            self.__incrementRowIdIndex()

        return newImgCmdFrameletList
Adds elements to self.framelet_list as the discrete turns cmds
Adds elements to self.framelet_list as the discrete turns cmds
Adds elements to self . framelet_list as the discrete turns cmds
def __fetchNewData(self, size):
        frameCount = 0;
        newImgCmdFrameletList = []
        while frameCount < size:
            self.cursor.execute("""SELECT * FROM {0} WHERE Id=?""".format(self.table), self.rowIdList[self.rowIdIndex])
            row = self.cursor.fetchone()
            framelet_list = pickle.loads(row.ImageByteArray) 
            shuffle(framelet_list)
            if(self.trainType.value == TrainType.DiscreteTurns.value):
                for framelet in framelet_list:
                    if (framelet.cmd[0:4] != Commands.NO_CMD.value[0:4] and framelet.cmd[0:4] != Commands.STOP_ALL_MOTORS.value[0:4]):
                        img = framelet.frame
                        img = normalizeData(img, self.normalizationMethod)
                        if (self.shouldReshapeImg):
                            img = img.reshape(-1)
                        newImgCmdFrameletList.append((img, framelet.cmd[0:4]))
                        frameCount +=1
            elif(self.trainType.value == TrainType.SteerAngles.value): 
                for framelet in framelet_list:
                    img = framelet.frame
                    img = normalizeData(img, self.normalizationMethod)
                    if (self.shouldReshapeImg):
                        img = img.reshape(-1)
                    newImgCmdFrameletList.append((img, framelet.steerDegree))
                    frameCount +=1
            else:
                msg = "Unknown trainType. trainType is of type TrainType. Your value is : {}".format(self.trainType.name)
                raise ValueError(msg)
            self.__incrementRowIdIndex()
        return newImgCmdFrameletList
def __fetchNewData ( self , size ) : frameCount = 0 ; newImgCmdFrameletList = [ ] while frameCount < size : self . cursor . execute ( """SELECT * FROM {0} WHERE Id=?""" . format ( self . table ) , self . rowIdList [ self . rowIdIndex ] ) row = self . cursor . fetchone ( ) framelet_list = pickle . loads ( row . ImageByteArray ) shuffle ( framelet_list ) if ( self . trainType . value == TrainType . DiscreteTurns . value ) : for framelet in framelet_list : if ( framelet . cmd [ 0 : 4 ] != Commands . NO_CMD . value [ 0 : 4 ] and framelet . cmd [ 0 : 4 ] != Commands . STOP_ALL_MOTORS . value [ 0 : 4 ] ) : img = framelet . frame img = normalizeData ( img , self . normalizationMethod ) if ( self . shouldReshapeImg ) : img = img . reshape ( - 1 ) newImgCmdFrameletList . append ( ( img , framelet . cmd [ 0 : 4 ] ) ) frameCount += 1 elif ( self . trainType . value == TrainType . SteerAngles . value ) : for framelet in framelet_list : img = framelet . frame img = normalizeData ( img , self . normalizationMethod ) if ( self . shouldReshapeImg ) : img = img . reshape ( - 1 ) newImgCmdFrameletList . append ( ( img , framelet . steerDegree ) ) frameCount += 1 else : msg = "Unknown trainType. trainType is of type TrainType. Your value is : {}" . format ( self . trainType . name ) raise ValueError ( msg ) self . __incrementRowIdIndex ( ) return newImgCmdFrameletList
Adds elements to self.framelet_list as the discrete turns cmds
Adds elements to self . framelet_list as the discrete turns cmds
'''Adds elements to self.framelet_list as the discrete turns cmds''' #get the framelet_list # img = self.__normalizeData(img) #cmds are steering angles # frameCount += row.FrameCount
self
size