Exemple #1
0
    def load(cls, file_name):
        config = deserialize_config(file_name)

        skil_server = Skil.from_config()
        experiment = get_experiment_by_id(skil_server, config['experiment_id'])
        result = Model(model_id=config['model_id'],
                       experiment=experiment, create=False)
        result.name = config['model_name']
        return result
Exemple #2
0
def enter():

    enemy.dead = 0
    enemy.life = 100

    gfw.world.init(['bg', 'card', 'state', 'ui'])

    gfw.world.remove(highscore)
    center = get_canvas_width() // 2, get_canvas_height() // 1.4
    center2 = get_canvas_width() // 2, 250
    hp = 150, 700
    gfw.world.add(gfw.layer.bg, gobj.ImageObject(theme + '/black.png',
                                                 center2))
    gfw.world.add(gfw.layer.bg, gobj.ImageObject(theme + '/bg.png', center))
    #gfw.world.add(gfw.layer.bg, gobj.ImageObject(theme + '/gaugefg.png', hp))

    x, y = start_x, start_y
    idxs = [n + 1 for n in range(9)]
    #print('before:', idxs)
    #random.shuffle(idxs)
    #print('after: ', idxs)

    for i in range(0, 9, +3):
        print(idxs[i:i + 3])
    for i in idxs:
        c = Pattern(i, (x, y), theme)
        gfw.world.add(gfw.layer.card, c)
        x += Pattern.WIDTH + PADDING - 100
        if x > get_canvas_width():
            x = start_x
            y -= Pattern.HEIGHT + PADDING - 100

    icon = Skil(1, (150, 200), theme)
    gfw.world.add(gfw.layer.card, icon)

    pla = Player(1, (550, 450), theme)

    gfw.world.add(gfw.layer.card, pla)
    ene = Enemy(1, (150, 480), theme)
    gfw.world.add(gfw.layer.card, ene)

    global last_card
    last_card = None

    global TIME, font
    TIME = 1000
    font = gfw.font.load(gobj.res('ENCR10B.TTF'), 20)
    highscore.load()

    global bg_music, flip_wav

    bg_music = load_music(gobj.res('bg1.mp3'))
    bg_music.set_volume(60)
    flip_wav = load_wav(gobj.res('pipe.wav'))
    bg_music.repeat_play()
    def load(cls, file_name):
        config = deserialize_config(file_name)

        skil_server = Skil.from_config()
        experiment = get_experiment_by_id(skil_server, config['experiment_id'])
        transform_type = config['transform_type']
        result = Transform(transform_id=config['transform_id'],
                           transform_type=transform_type,
                           experiment=experiment,
                           create=False)
        result.name = config['transform_name']

        return result
Exemple #4
0
from skil import Skil, WorkSpace, Experiment, Model, Deployment
from keras.datasets import mnist

skil_server = Skil()
work_space = WorkSpace(skil_server)
experiment = Experiment(work_space)
model = Model('model.pb', model_id='tf_model', experiment=experiment)

deployment = Deployment(skil_server)
service = model.deploy(deployment,
                       input_names=['input'],
                       output_names=['output'])

(x_train, y_train), (x_test, y_test) = mnist.load_data()
x_test = x_test.reshape(10000, 784)
x_test = x_test.astype('float32')
x_test /= 255

print(service.predict_single(x_test[0]))
print(service.predict(x_test[:10]))
from skil import Skil, Service, utils
from skil import get_workspace_by_id
from skil import get_experiment_by_id
from skil import get_model_by_id
from skil import get_deployment_by_id

from utils import annotate_image
from time import time
import cv2

skil_server = Skil(
    host      = 'localhost',
    port      = 9008,
    user_id   = 'admin',
    password  = '******'
)

experiment = skil_server.api.list_all_experiments(skil_server.server_id)[0]

workspace_id  = experiment.model_history_id
experiment_id = 'yolo-experiment-01'
model_id      = 'yolo-model-01'
deployment_id = '0'

work_space = get_workspace_by_id(skil_server, workspace_id)
experiment = get_experiment_by_id(work_space, experiment_id)
deployment = get_deployment_by_id(skil_server, deployment_id)
model = get_model_by_id(experiment, model_id)

service = Service(
    skil=skil_server,
Exemple #6
0
#import skil_client
#
#configuration = skil_client.Configuration()
#configuration.host = 'http://52.15.103.124:9008'
#configuration.api_key['authorization'] = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJTa2lsVXNlciIsInN1YiI6IntcInVzZXJJZFwiOlwiYWRtaW5cIixcInVzZXJOYW1lXCI6XCJhZG1pblwiLFwicm9sZVwiOlwiYWRtaW5cIixcInNjb3BlXCI6XCJhZG1pblwifSIsImlzcyI6IlNraWxBdXRoTWFuYWdlciIsImV4cCI6MTU4NjgyODcxMCwiaWF0IjoxNTU1MjkyNzEwfQ.vXXpr0kk9H8nMbkcM8sPWPJwuws1GGvI8SWc76qKvUo'
#api_instance = skil_client.DefaultApi(skil_client.ApiClient(configuration))
#api_response = api_instance.predictimage("yolo", "default", "yolomodel", image='input.jpg')
#
from skil import Skil

skil_server = Skil(host='52.15.103.124', password='******')

from skil import WorkSpace, Experiment, Model

work_space = WorkSpace(skil_server, name="Object detection project")
experiment = Experiment(work_space, name="YOLO")
model = Model('yolo_v2.pb', name='yolo_model', experiment=experiment)
#
from skil import Deployment

deployment = Deployment(skil_server)
service = model.deploy(deployment,
                       scale=1,
                       input_names=['input'],
                       output_names=['output'])
#
#from skil.utils.yolo import annotate_image
#import cv2
#
#image = cv2.imread('input.jpg')
#detection = service.detect_objects(image)
                'host': 'localhost',  # Edit this if using docker-machine.
                'port': '9008',
                'username': '******',
                'password': '******',
                'workspace_id': '',
                'experiment_id': '',
                'deployment_id': ''
            },
            f)

with open('.skil', 'r') as f:
    skil_conf = json.load(f)

# Connect to SKIL and create an experiment for storing our model experiments.
skil_server = Skil(host=skil_conf['host'],
                   port=skil_conf['port'],
                   user_id=skil_conf['username'],
                   password=skil_conf['password'])

work_space = None
if skil_conf['workspace_id'] == '':
    work_space = WorkSpace(skil_server, name="Mnist Sample")
    skil_conf['workspace_id'] = work_space.id
else:
    work_space = skil.get_workspace_by_id(None, skil_server,
                                          skil_conf['workspace_id'])

experiment = None
if skil_conf['experiment_id'] == '':
    experiment = Experiment(work_space, name='Simple MLP')
    skil_conf['experiment_id'] = experiment.id
else: