/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training.py in _method_wrapper(self, *args, **kwargs)
106 def _method_wrapper(self, *args, **kwargs):
107 if not self._in_multi_worker_mode(): # pylint: disable=protected-access
--> 108 return method(self, *args, **kwargs)
109
110 # Running inside `run_distribute_coordinator` already.
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, validation_batch_size, validation_freq, max_queue_size, workers, use_multiprocessing)
1096 batch_size=batch_size):
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 matplotlib.pyplot as plt | |
import seaborn as sns | |
import numpy as np | |
sns.set() | |
def ndcg_at_k(ranked_relevances, k=None): | |
""" | |
Calculate NDCG for given ranked relevances. | |
""" |
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 cv2 | |
import copy | |
import pycocotools.mask as mask_util | |
import numpy as np | |
class CopyPasteAugmentator: | |
"""Copy-paste cells from another image in the dataset | |
""" | |
def __init__(self, d2_dataset, |
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
class YourAgent: | |
def __init__(self, | |
# ... other params | |
# ... | |
antigeo_thresh=20): | |
# ... | |
# Initialize your agent here ... | |
# ... | |
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 operator | |
import numpy as np | |
import cmath | |
from collections import namedtuple | |
basis = np.array([1, cmath.exp(2j * cmath.pi * 1 / 3), cmath.exp(2j * cmath.pi * 2 / 3)]) | |
HistMatchResult = namedtuple("HistMatchResult", "idx length") | |
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
# These are probably the only important parameters in the | |
# whole pipeline (steps 0 through 3). | |
BLOCK_SIZE = 40 | |
DELTA = 25 | |
# Do the necessary noise cleaning and other stuffs. | |
# I just do a simple blurring here but you can optionally | |
# add more stuffs. | |
def preprocess(image): | |
image = cv2.medianBlur(image, 3) |
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
# Somehow I found the value of `gamma=1.2` to be the best in my case | |
def adjust_gamma(image, gamma=1.2): | |
# build a lookup table mapping the pixel values [0, 255] to | |
# their adjusted gamma values | |
invGamma = 1.0 / gamma | |
table = np.array([((i / 255.0) ** invGamma) * 255 | |
for i in np.arange(0, 256)]).astype("uint8") | |
# apply gamma correction using the lookup table | |
return cv2.LUT(image, table) |
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
mnetv2: 601833648 FLOPs | |
alexnet: 2079939473 FLOPs | |
vgg19: 39285112688 FLOPs | |
vgg16: 30960211824 FLOPs | |
body_0: 208719616 FLOPs | |
mood_head: 396661522 FLOPs | |
roa_head: 68190732 FLOPs | |
art_head: 396730804 FLOPs |
You don't want Xorg to use your NVIDIA gpu. Need to blacklist nouveau and nvidia-drm.
In the created file /etc/modprobe.d/blacklist-nouveau.conf
:
blacklist nouveau
options nouveau modeset=0
In the file /etc/modprobe.d/blacklist-nvidia-drm.conf
:
blacklist nvidia-drm
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
" ------------------- BEGIN: VUNDLE CONFIGURATION ------------------- | |
set nocompatible " required | |
filetype off " required | |
" set runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" let Vundle handle itself, required! | |
Plugin 'VundleVim/Vundle.vim' |
NewerOlder