Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

h5 model file unavailable? #53

Closed
nicoa47 opened this issue Jun 13, 2022 · 6 comments
Closed

h5 model file unavailable? #53

nicoa47 opened this issue Jun 13, 2022 · 6 comments

Comments

@nicoa47
Copy link

nicoa47 commented Jun 13, 2022

In CLI, after a quick attempt at running ut init --name <...> --model usleep followed by ut predict I get an error saying RuntimeError: Did not find any model parameter files in model subfolder <...>. Model files should have extension '.h5' to be recognized.

Is it normal that no h5 file is located in the model subfolder after init?

@perslev
Copy link
Owner

perslev commented Jun 14, 2022

Hi nicoa47,

The ut init script simply prepares a new (empty) project folder. I.e., a folder that stores templates for the hyperparameter files needed to fit a specific type of model. You will need to fit the model yourself in order to use it for prediction.

If you are only looking to use the U-Sleep model as presented in this paper, you can do so for free at https://sleep.ai.ku.dk for research purposes. There is also an API with a CLI here, e.g. to score an EDF file:

pip install usleep-api
usleep-api ./my_psg.edf ./hypnogram.tsv --anonymize

This will upload an anonymized version of the file ./my_psg.edf to the U-Sleep webservice, then download the scored hypnogram and save it to ./hypnogram.tsv.

If you are not able to upload (anonymized) data to the webservice, please let me know.

Cheers
Mathias

@nicoa47
Copy link
Author

nicoa47 commented Jun 14, 2022

Thanks for the very quick and helpful response! I will try the web api. Another short question: Do the results obtained from using this API include confidence scores? I am wondering since I couldn't find any when I directly uploaded data to the https://sleep.ai.ku.dk/ interface.

@perslev
Copy link
Owner

perslev commented Jun 14, 2022

No problem! The API does not currently support getting confidence scores, but this is something I could implement as it may be generally useful. I will take a look to see how much work would be required and get back to you.

@perslev
Copy link
Owner

perslev commented Jun 14, 2022

This turned out to be relative straight forward, so you can now download .npy array files with confidence scores from both the web interface and using the API/CLI:

>> usleep-api ./my_psg.edf ./hypnogram.npy --anonymize --with-confidence-scores

Good luck with your project!

Edit: you should update the usleep-api package to version 0.1.3 before running the above.

@nicoa47
Copy link
Author

nicoa47 commented Jun 14, 2022

thanks so much!

@perslev
Copy link
Owner

perslev commented Jun 16, 2022

No problem!

@perslev perslev closed this as completed Jun 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants