This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
import numpy as np | |
import argparse | |
from PIL import Image, ImageFilter | |
import time | |
import chainer | |
from chainer import cuda, Variable, serializers | |
from net import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import zmq | |
import zmq_utils | |
# Setup ZeroMQ image publisher & receiver | |
context = zmq.Context() | |
sub = context.socket(zmq.SUB) | |
sub.setsockopt_string(zmq.SUBSCRIBE, "image") | |
sub.set_hwm(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import json | |
import zmq | |
def send_image(socket, image, channel = b"image"): | |
# Serialize a Numpy array | |
dtype = str(image.dtype).encode('ascii') | |
shape = json.dumps(image.shape).encode('ascii') | |
data = image.tostring('C') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import time | |
import scorer | |
import zmq | |
import zmq_utils | |
# Setup ZeroMQ image publisher & receiver | |
context = zmq.Context() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import zmq | |
import numpy as np | |
import json | |
import time | |
# ZeroMQ のバックグラウンド・スレッドのコンテキスト | |
context = zmq.Context() | |
# このクライアントは、ポート5556に接続します(バックグラウンドにて) | |
socket = context.socket(zmq.REP) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import zmq | |
import numpy as np | |
import json | |
# ZeroMQ のバックグラウンド・スレッドのコンテキスト | |
context = zmq.Context() | |
# このサーバは、ポート5556で待ちます | |
socket = context.socket(zmq.REQ) | |
socket.bind("tcp://*:5556") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import zmq | |
if (len(sys.argv) != 2): | |
print("Usage: # python3 {} <channel>".format(sys.argv[0])) | |
sys.exit(1) | |
ch = sys.argv[1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import zmq | |
import time | |
if (len(sys.argv) != 2): | |
print("Usage: # python3 {} {{alphabet|number}}".format(sys.argv[0])) | |
sys.exit(1) | |
mode = sys.argv[1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import zmq | |
if (len(sys.argv) != 2): | |
print("Usage: # python3 {} <channel>".format(sys.argv[0])) | |
sys.exit(1) | |
ch = sys.argv[1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import zmq | |
import time | |
# ZeroMQ のバックグラウンド・スレッドのコンテキスト | |
context = zmq.Context() | |
# このサーバは、ポート5556で待ちます | |
socket = context.socket(zmq.PUB) | |
socket.bind("tcp://*:5556") |