Compare commits

...

3 Commits

Author SHA1 Message Date
Michael Pilosov, PhD
13dd754ba6 nice set of params 2024-02-13 06:46:18 +00:00
Michael Pilosov, PhD
a97055f282 GNU parallel 2024-02-13 05:35:54 +00:00
Michael Pilosov, PhD
d1b963e05d minimal requirements. 2024-02-13 05:35:44 +00:00
4 changed files with 18 additions and 9 deletions

View File

@ -55,9 +55,12 @@ umap:
python scripts/sortcolor.py -s umap --dpi 300 --seed $$seed ; \
done
sort_umap:;
sort_umap:
python scripts/sortcolor.py -s umap --dpi 300 --seed 21
parallel_umap:
parallel -j 12 python scripts/sortcolor.py -s umap --dpi 300 --seed ::: $$(seq 101 112)
sort_lex:
python scripts/sortcolor.py -s lex --dpi 300

Binary file not shown.

View File

@ -1,3 +1,5 @@
pip install \
--extra-index-url=https://pypi.nvidia.com \
cudf-cu12==23.12.* cuml-cu12==23.12.*
cudf-cu12==23.12.* cuml-cu12==23.12.* \
dask-cudf-cu12==23.12.* pylibraft-cu12==23.12.* \
raft-dask-cu12==23.12.*

View File

@ -86,14 +86,16 @@ elif KIND == "umap":
reducer = UMAP(
n_components=1,
n_neighbors=250,
min_dist=0.005,
min_dist=1e-2,
metric="euclidean",
random_state=SEED,
negative_sample_rate=2,
)
embedding = reducer.fit_transform(np.array(rgb_values))
# Sort colors by the 1D representation
preds = embedding[:, 0]
del reducer, embedding
elif KIND in ("cielab", "lab", "ciede2000"):
from skimage.color import deltaE_ciede2000, rgb2lab
@ -130,10 +132,11 @@ else:
sorted_indices = np.argsort(preds)
# Save the sorted indices to disk
if (KIND == "umap" and SEED == 21) or (KIND != "umap"):
file_path = f"scripts/{KIND}_sorted_indices.npy"
np.save(file_path, sorted_indices)
print(f"Sorted indices saved to {file_path}")
# if (KIND == "umap") or (KIND != "umap"):
Path(f"scripts/{KIND}").mkdir(parents=True, exist_ok=True)
file_path = f"scripts/{KIND}/preds_{SEED:06d}.npy"
np.save(file_path, preds)
print(f"Predictions saved to {file_path}")
# Sort colors by the 1D representation
sorted_colors = [colors[i] for i in sorted_indices]
@ -280,18 +283,19 @@ def plot_preds(
prefix = ""
if KIND == "umap":
prefix = f"{SEED:02d}"
prefix = f"{SEED:04d}"
fname = f"{DIR}/{prefix}{KIND}_sorted_colors_circle.png"
plot_preds(
preds,
np.array(rgb_values),
fname,
roll=True,
roll=False,
dpi=DPI,
inner_radius=INNER_RADIUS,
figsize=(SIZE, SIZE),
)
print(f"saved {fname}")
HILBERT = False