资源简介

本程序经过测试,可以在安装有微信的机器上运行,可以微信控制训练的开始,停止,及微信修改参数再训练,可以将自己想要的结果,实时的发送到自己(或指定)的微信上,使用过程有什么问题可以私信交流wfc117@163.com

资源截图

代码片段和文件信息

import itchat
import threading


class WeChatSendMsg:

    def __init__(self user_name=‘filehelper‘):
        # Create a running status flag
        self._lock = threading.Lock()
        self._running = False
        self._run_state = self._running

        self._func_name = None
        self._user_name = user_name

        # parameters
        self._learning_rate = 0.001
        self._epochs = 10
        self._steps_per_epoch = 200000
        self._batch_size = 128

        self._param_dict = {‘learning_rate‘: self._learning_rate
                            ‘epochs‘: self._epochs
                            ‘steps_per_epoch‘: self._steps_per_epoch
                            ‘batch_size‘: self._batch_size
                            }

    def send(self msg to_user_names=None):
        user_token = []
        if to_user_names is not None:
            to_user_names = list(set(to_user_names))
            friends = itchat.get_friends()[:]
            for item in friends:
                [user_token.append(item[‘UserName‘])
                 for user_name in to_user_names
                 if (user_name == item[‘RemarkName‘] or
                     user_name == item[‘NickName‘])
                 ]
        if len(user_token) == 0:
            user_token.append(self._user_name)
        for token in user_token:
            itchat.send(msg toUserName=token)

    def _is_stop(self stat):
        with self._lock:
            self._running = False if stat else True

    def close(self):
        self._is_stop(True)

    def get_run_state(self):
        with self._lock:
            self._run_state = self._running
        return self._run_state

    def _deal_with_params(self super_params):
        super_params = super_params.strip()
        # if ‘ ‘ in super_params:
        #     res = super_params.split(‘ ‘)
        # if ‘‘ in super_params:
        res = super_params.split(‘‘)

        if ‘=‘ not in super_params:
            self._learning_rate = float(res[0])
            self._epochs = int(res[1])
            self._steps_per_epoch = int(res[2])
            self._batch_size = int(res[3])
        else:
            for item in res:
                key val = item.split(‘=‘)
                key = key.strip()
                val = val.strip()
                if key == ‘lr‘:
                    self._learning_rate = float(val)
                if key == ‘epc‘:
                    self._epochs = int(val)
                if key == ‘spe‘:
                    self._steps_per_epoch = int(val)
                if key == ‘bs‘:
                    self._batch_size = int(val)

        self._param_dict = {‘learning_rate‘: self._learning_rate
                            ‘epochs‘: self._epochs
                            ‘steps_per_epoch‘: self._steps_per_epoch
                            ‘batch_size‘: self._batch_size
                            }
        return self._param_dict

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-08-27 09:38  tf_wechat\
     目录           0  2018-09-08 17:26  tf_wechat\.git\
     文件          11  2018-08-22 19:05  tf_wechat\.git\COMMIT_EDITMSG
     文件          23  2018-08-22 19:03  tf_wechat\.git\HEAD
     文件         307  2018-08-22 19:03  tf_wechat\.git\config
     文件          73  2018-08-22 19:03  tf_wechat\.git\description
     目录           0  2018-08-22 19:03  tf_wechat\.git\hooks\
     文件         478  2018-08-22 19:03  tf_wechat\.git\hooks\applypatch-msg.sample
     文件         896  2018-08-22 19:03  tf_wechat\.git\hooks\commit-msg.sample
     文件         189  2018-08-22 19:03  tf_wechat\.git\hooks\post-update.sample
     文件         424  2018-08-22 19:03  tf_wechat\.git\hooks\pre-applypatch.sample
     文件        1642  2018-08-22 19:03  tf_wechat\.git\hooks\pre-commit.sample
     文件        1348  2018-08-22 19:03  tf_wechat\.git\hooks\pre-push.sample
     文件        4898  2018-08-22 19:03  tf_wechat\.git\hooks\pre-rebase.sample
     文件         544  2018-08-22 19:03  tf_wechat\.git\hooks\pre-receive.sample
     文件        1492  2018-08-22 19:03  tf_wechat\.git\hooks\prepare-commit-msg.sample
     文件        3610  2018-08-22 19:03  tf_wechat\.git\hooks\update.sample
     文件        1145  2018-08-22 19:05  tf_wechat\.git\index
     目录           0  2018-08-22 19:03  tf_wechat\.git\info\
     文件         240  2018-08-22 19:03  tf_wechat\.git\info\exclude
     目录           0  2018-08-22 19:05  tf_wechat\.git\logs\
     文件         156  2018-08-22 19:05  tf_wechat\.git\logs\HEAD
     目录           0  2018-08-22 19:05  tf_wechat\.git\logs\refs\
     目录           0  2018-08-22 19:05  tf_wechat\.git\logs\refs\heads\
     文件         156  2018-08-22 19:05  tf_wechat\.git\logs\refs\heads\master
     目录           0  2018-08-22 19:05  tf_wechat\.git\logs\refs\remotes\
     目录           0  2018-08-22 19:05  tf_wechat\.git\logs\refs\remotes\origin\
     文件         142  2018-08-22 19:05  tf_wechat\.git\logs\refs\remotes\origin\master
     目录           0  2018-08-22 19:05  tf_wechat\.git\objects\
     目录           0  2018-08-22 19:05  tf_wechat\.git\objects\14\
     文件         124  2018-08-22 19:05  tf_wechat\.git\objects\14\af826f87025a55efd6c615f81eb61c5a071e70
............此处省略53个文件信息

评论

共有 条评论