if __name__ == '__main__': counter_n = 0 m = PyMouse() redeclipse_center = [960, 564] offline_position = [1157, 1157, 523, 523] gametab_position = [593, 593, 132, 132] select_position = [564, 564, 248, 248] disconnect_position = [1184, 1184, 703, 703] output_keysList = [] n_input, tensor_size, lstm_classes, n_hidden, lstm_based_Bots, cnn_classes = cgrAPI.gameBotParamInit( 1, 20, 5, 512, 0, 1) associate_flag, RUNNING_TIME, AI_BOTS_DIR, RESULT_DIR, BIND_CPU, HUMAN_RUN, Reso_Width, Reso_Hight, MultipleMode = cgrAPI.globalParamInit( ) lstmX, lstmPred, lstmInit, lstmSaver, lstmLogPath = cgrAPI.LSTMInit( "redeclipse", AI_BOTS_DIR, n_input, tensor_size, lstm_classes, n_hidden) pic_region, cnnDetection_graph, cnnDetector = cgrAPI.CNNInit( "redeclipse", AI_BOTS_DIR, Reso_Width, Reso_Hight, cnn_classes) output_file = cgrAPI.logsInit(RESULT_DIR) cgrAPI.commandInit("redeclipse", associate_flag, RUNNING_TIME, BIND_CPU, HUMAN_RUN, MultipleMode, 5) with mss.mss(display=':0.0') as sct: with tf.Session() as lstmSession: lstmSession.run(lstmInit) if os.path.isfile(lstmLogPath + "checkpoint"): lstmSaver.restore(lstmSession, lstmLogPath + "lstm-model") with tf.Session(graph=cnnDetection_graph) as cnnSession: start_time = time.time() cur_time = time.time()
angle += calculate_angle(points) angle = angle / len(brickLongEdgePoint) lstmInputVec = [last_angle, angle] return lstmInputVec, img_birdeye if __name__ == '__main__': count = 0 supertuxkart_restart = [985, 985, 1030, 1030] lstmInputVec = [0, 0] n_input, tensor_size, lstm_classes, n_hidden, lstm_based_Bots, cnn_classes = cgrAPI.gameBotParamInit( 1, 2, 3, 512, 1, 2) associate_flag, RUNNING_TIME, AI_BOTS_DIR, RESULT_DIR, BIND_CPU, HUMAN_RUN, Reso_Width, Reso_Hight, MultipleMode = cgrAPI.globalParamInit( ) lstmX, lstmPred, lstmInit, lstmSaver, lstmLogPath = cgrAPI.LSTMInit( "supertuxkart", AI_BOTS_DIR, n_input, tensor_size, lstm_classes, n_hidden) pic_region, cnnDetection_graph, cnnDetector = cgrAPI.CNNInit( "supertuxkart", AI_BOTS_DIR, Reso_Width, Reso_Hight, cnn_classes) output_file = cgrAPI.logsInit(RESULT_DIR) cgrAPI.commandInit("supertuxkart", associate_flag, RUNNING_TIME, BIND_CPU, HUMAN_RUN, MultipleMode, 3) with mss.mss(display=':0.0') as sct: with tf.Session() as lstmSession: lstmSession.run(lstmInit) if os.path.isfile(lstmLogPath + "checkpoint"): lstmSaver.restore(lstmSession, lstmLogPath + "lstm-model") with tf.Session(graph=cnnDetection_graph) as cnnSession: start_time = time.time()