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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure("2") do |config| | |
config.vm.box = "Microsoft/EdgeOnWindows10" | |
config.vm.box_version = "1.0" | |
config.vm.provider "virtualbox" do |vb| | |
# guiの設定 | |
vb.gui = true |
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 notebook.base.handlers import APIHandler as IPyAPIHandler | |
import json | |
class APIHandler(IPyAPIHandler): | |
def set_default_headers(self): | |
self.set_header('Content-Type', 'application/json') | |
def finish(self, chunk=None): | |
if type(chunk) == dict: |
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
# coding: utf-8 | |
from logging import getLogger, Formatter, StreamHandler | |
import logging | |
def logger( | |
logger_name='', | |
level=logging.DEBUG, | |
Handler=StreamHandler, |
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
``` | |
Example of Usage | |
--- | |
visualize_targets = [ | |
'key of your network layer', | |
'for example:', | |
'conv1', | |
'residual_block1.conv1', | |
'residual_block1.conv2' | |
] |
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
# coding: utf-8 | |
import chainer | |
import chainer.functions as F | |
import chainer.links as L | |
try: | |
from chainer.backend import get_array_module | |
except: | |
import numpy as np |
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 chainer | |
import chainer.functions as F | |
class Dropout1d(chainer.Chain): | |
''' | |
spatial dropout module (1d) | |
''' | |
def __init__(self, raito=.5): | |
super().__init__() |
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 chainer | |
import chainer.functions as F | |
from chainer import LinkHook | |
from typing import List, Optional | |
import cv2 | |
class IntermidateCache(LinkHook): | |
def __init__(self, layer: chainer.Chain): | |
layer.add_hook(self) |
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 chainer.functions as F | |
try: | |
from chainer.backend import get_array_module | |
except: # if you don't use cuda | |
import numpy as np | |
get_array_module = lambda x: np | |
def focal_loss(y_pred, y_true, scale=2): | |
xp = get_array_module(y_pred) | |
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
# coding: utf-8 | |
from io import BytesIO | |
import cv2 | |
from fnmatch import fnmatch | |
from google.cloud.storage import Client, Blob | |
import numpy as np | |
import pandas as pd | |
import os.path | |
from pathlib import Path |
OlderNewer