Skip to content

Instantly share code, notes, and snippets.

@syaffers
Created December 4, 2020 10:04
Show Gist options
  • Save syaffers/e0a00365d28bd7a823513521ebb7697b to your computer and use it in GitHub Desktop.
Save syaffers/e0a00365d28bd7a823513521ebb7697b to your computer and use it in GitHub Desktop.
Displaying computaitonal burdens using dask in jupyter notebooks
src = np.array(imread('carles-rabada-DD1fSz2HF1s-unsplash-small.png'))[:, :, :3]
trn = np.array(imread('olia-gozha-9A_peGrSbZc-unsplash-small.png'))[:, :, :3]
src = np.unique(src.reshape(-1, 3), axis=0)
trn = np.unique(trn.reshape(-1, 3), axis=0)
self_da = da.from_array(src.astype(np.long), chunks=(1024, 3))
other_da = da.from_array(trn.reshape(-1, 1, 3).astype(np.long),
chunks=(1024, 1, 3))
rgb_da = self_da - other_da
display(self_da)
display(other_da)
display(rgb_da)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment