-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
save pnas classifiers in new keras formats
- Loading branch information
1 parent
982e621
commit b3c6779
Showing
42 changed files
with
30 additions
and
14 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import keras | ||
import os | ||
|
||
len_model = 1500 | ||
|
||
# ### Convert SaveModel format to h5 format | ||
# list_files = os.listdir(f'saved_classifiers/bury_pnas_21/len{len_model}/') | ||
# pkl_files = [f for f in list_files if f[-4:]=='.pkl'] | ||
|
||
# for pkl_file in pkl_files: | ||
# model = keras.models.load_model(f'saved_classifiers/bury_pnas_21/len{len_model}/{pkl_file}') | ||
# #Save the model into h5 format | ||
# model_h5_name = pkl_file[:-4]+".h5" | ||
# model.save(f'saved_classifiers/bury_pnas_21/len{len_model}/{model_h5_name}') | ||
# print(f'saved model as {model_h5_name}') | ||
|
||
### Convert h5 format to .keras format | ||
list_files = os.listdir(f"saved_classifiers/bury_pnas_21/len{len_model}/") | ||
h5_files = [f for f in list_files if f[-3:] == ".h5"] | ||
|
||
for h5_file in h5_files: | ||
model = keras.models.load_model( | ||
f"saved_classifiers/bury_pnas_21/len{len_model}/{h5_file}" | ||
) | ||
# Save the model into h5 format | ||
model_keras_format_name = h5_file[:-3] + ".keras" | ||
model.save( | ||
f"saved_classifiers/bury_pnas_21/len{len_model}/{model_keras_format_name}" | ||
) | ||
print(f"saved model as {model_keras_format_name}") |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.