BMXnet中的resnet-binary模型训练我自己的数据,但获得浮点权重而不是二进制权重

时间:2018-08-23 12:20:22

标签: python-3.x mxnet resnet

我已经在BMXnet中使用resnet-binary模型来训练自己的数据,但是得到的是float权重而不是二进制权重。为什么?

网络参数

enter image description here

加载经过训练的模型并使用# -*- coding: utf-8 -*- import concurrent.futures import requests import queue import threading # URL Pool URLS = [ # Put your urls here ] # Time interval (in seconds) INTERVAL = 5 * 60 # The number of worker threads MAX_WORKERS = 4 # You should set up request headers # if you want to better evade anti-spider programs HEADERS = { 'Accept': '*/*', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'en-US,en;q=0.9', 'Cache-Control': 'max-age=0', 'Connection': 'keep-alive', #'Host': None, 'If-Modified-Since': '0', #'Referer': None, 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.62 Safari/537.36', } ############################ def handle_response(response): # TODO implement your logics here !!! raise RuntimeError('Please implement function `handle_response`!') # Retrieve a single page and report the URL and contents def load_url(session, url): #print('load_url(session, url={})'.format(url)) response = session.get(url) if response.status_code == 200: # You can refactor this part and # make it run in another thread # devoted to handling local IO tasks, # to reduce the burden of Net IO worker threads return handle_response(response) def ThreadPoolExecutor(): return concurrent.futures.ThreadPoolExecutor(max_workers=MAX_WORKERS) # Generate a session object def Session(): session = requests.Session() session.headers.update(HEADERS) return session # We can use a with statement to ensure threads are cleaned up promptly with ThreadPoolExecutor() as executor, Session() as session: if not URLS: raise RuntimeError('Please fill in the array `URLS` to start probing!') tasks = queue.Queue() for url in URLS: tasks.put_nowait(url) def wind_up(url): #print('wind_up(url={})'.format(url)) tasks.put(url) while True: url = tasks.get() # Work executor.submit(load_url, session, url) threading.Timer(interval=INTERVAL, function=wind_up, args=(url,)).start()

enter image description here

1 个答案:

答案 0 :(得分:0)

似乎需要对模型进行二值化的步骤。查看该项目的仓库:https://github.com/hpi-xnor/BMXNet

通过在该存储库的“问题”标签中发布,您可能会获得更多的专业帮助。