Skip to content

Commit

Permalink
Add careamist snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
jdeschamps committed May 28, 2024
1 parent f64ff6d commit 8590e38
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions guides/careamist/careamist.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# %%
from careamics import CAREamist
from careamics.config import create_n2v_configuration

config = create_n2v_configuration(
experiment_name="n2v_2D",
data_type="array",
axes="YX",
patch_size=[64, 64],
batch_size=8,
num_epochs=20,
) # (1)!

careamist = CAREamist(config)


# %%
from careamics import CAREamist
from careamics.config import create_n2v_configuration, save_configuration

config = create_n2v_configuration(
experiment_name="n2v_2D",
data_type="array",
axes="YX",
patch_size=[64, 64],
batch_size=8,
num_epochs=20,
)

save_configuration(config, "configuration_example.yml")

careamist = CAREamist("configuration_example.yml")

# %%
# necessary to export to the BMZ (pretending it trained)
careamist.cfg.data_config.set_mean_and_std(0.0, 1.0)

# %%
careamist.export_to_bmz(
path="model.zip", name="MyExampleModel", authors=[{"name": "CAREamics"}]
)

# %%
from careamics import CAREamist

path_to_model = "model.zip" # (1)!

careamist = CAREamist(path_to_model)

# %%
careamist = CAREamist(path_to_model, experiment_name="a_new_experiment")


# %%
careamist = CAREamist(config, work_dir="work_dir")

0 comments on commit 8590e38

Please sign in to comment.