Created
October 17, 2019 08:51
-
-
Save thorstenwagner/4f82ac649918970a3d18195e9504df32 to your computer and use it in GitHub Desktop.
Example cinderella
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 Auto2DSelect.auto_2d_select import Auto2DSelectNet # Import cinderella | |
from Auto2DSelect import results_writer # Import writer | |
batch_size =4 # If you have memory problems, choose a smaller one | |
input_path = "path/to/classes.hdf" # path to your classes | |
weights_path = "path/to/weights.h5" # path to your trained model | |
# You can read the input size from the trained model or just set it to size used during training. | |
with h5py.File(weights_path, mode="r") as f: | |
try: | |
import numpy as np | |
input_size = tuple(f["input_size"]) | |
except KeyError: | |
pass | |
# Create network object | |
auto2dnet = Auto2DSelectNet(batch_size, input_size) #Create object | |
#Apply it to your data: | |
result = auto2dnet.predict(input_path, weights_path, good_thresh=threshold) | |
#Write the results to disk. It will write hdf or mrcs depending on your input | |
results_writer.write_labeled_hdf( | |
result, output_path, os.path.basename(input_path).split(".")[0] | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment