-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathv6.py
More file actions
23 lines (14 loc) · 679 Bytes
/
v6.py
File metadata and controls
23 lines (14 loc) · 679 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import numpy as np
import h5py
import pybind11_analysis
# Change: use custom C++ extension via pybind11 (see /pybind11_extension)
def load_probabilities(folder):
with h5py.File(folder / "data.hdf5", "r") as f:
return f["probabilities"][:]
def colorcode_probabilities(probabilities):
class_colors = np.array([[0, 0, 255], [0, 255, 0], [255, 0, 0], [0, 255, 255]], dtype=np.uint8)
colored_probabilities = pybind11_analysis.colorcode_probabilities(probabilities, class_colors)
return colored_probabilities
def load_and_colorcode_probabilities(folder):
probabilities = load_probabilities(folder)
return colorcode_probabilities(probabilities)