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 tensorflow as tf | |
from pathlib import Path | |
import pandas as pd | |
from tqdm import tqdm | |
from collections import defaultdict | |
# Get all event* runs from logging_dir subdirectories | |
logging_dir = Path('.', 'logs') | |
event_paths = logging_dir.glob('**/event*') |
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
cmake \ | |
-D CMAKE_BUILD_TYPE=RELEASE \ | |
-D CMAKE_INSTALL_PREFIX=/path/to/anaconda3/ \ | |
-D BUILD_NEW_PYTHON_SUPPORT=ON \ | |
-D BUILD_OPENCV_PYTHON3=OFF \ | |
-D BUILD_OPENCV_PYTHON2=OFF \ | |
-D INSTALL_C_EXAMPLES=OFF \ | |
-D INSTALL_PYTHON_EXAMPLES=OFF \ | |
-D BUILD_EXAMPLES=OFF \ | |
-D BUILD_JPEG=ON \ |
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 torch.autograd import Variable | |
import torch.nn as nn | |
import torch | |
# LSTM | |
hidden_size = 20 | |
num_layers = 2 | |
num_directions = 1 | |
# Input |
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
def dice(im1, im2, empty_score=1.0): | |
""" | |
Computes the Dice coefficient, a measure of set similarity. | |
Parameters | |
---------- | |
im1 : array-like, bool | |
Any array of arbitrary size. If not boolean, will be converted. | |
im2 : array-like, bool | |
Any other array of identical size. If not boolean, will be converted. | |
Returns |
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
// Convert a float RGB to int RGB. Note: does not check for floats outside range (0..1) | |
public static int rgbFloatToInt(float r, float g, float b) { | |
return ((int) (0xff * b)) | (((int) (0xff * g)) << 8 ) | (((int) (0xff * r)) << 16 ) ; | |
} |
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 java.util.HashMap; | |
import java.util.Map; | |
import java.util.Set; | |
import java.util.function.Consumer; | |
/** | |
* Created by Bruno on 01/03/2015. | |
* | |
* Table with type R for rows, C for columns and V for values | |
* |