Stanford-STAGES / stanford-stages

Automated sleep staging scoring and narcolepsy identification
76 stars 26 forks source link

Running the verify script in Windows #11

Closed Mensen closed 4 years ago

Mensen commented 4 years ago

Hi!

Thanks for the great tool!

I'm also generally a Unix user, but for several reasons I need to run these scripts from a windows machine. I'm also more of a Matlab user, with only limited experience with running Python scripts.

I downloaded Anaconda for Windows, hoping that would help me run things a little easier. Within Anaconda there is a powershell where I change directory and run things, but unfortunately "sh" does not seem to be a thing in windows (see screenshot attached)

Is there some trick for running the scripts in Windows?

Thanks! Armand

image

informaton commented 4 years ago

Hi Mensen, I will try to put together an equivalent .bat file that will work for windows in the next day or so and post a follow-up comment with instructions when it is ready.

Thanks, Hyatt

informaton commented 4 years ago

I just added (commit e8cda1d) the Windows batch file (verify_chp_040.bat) so you can run the equivalent verify_chp_040.sh script on Windows system.

Edit the verify_chp_040.bat file just like you would the verify_chp_040.sh file (e.g. set your output parameters, channel indices, and place the name of the actual file you want to run in the FILENAME variable (i.e. at the moment is "C:\Data\CHP040.edf", but likely you will have placed the file you want to use somewhere else).

Once that is done, either double click on the .bat file from a Windows Explorer or navigate to the repository from a command prompt or power shell and then type in the script name (i.e. _verify_chp040.bat) and press enter to run the program.

I was able to test it on Windows 10. Let me know if you run into any issues, otherwise I'll close this issue down in the next week or so.

Mensen commented 4 years ago

Thank you so much for looking into this and providing a fix. I ran into an error at the end of the process which is posted below.

Incidentally... Used the installation guide you provided here

But when I first ran the .bat file it stated it was missing matplotlib, and then skimage... I used conda to install the latest versions of those two, and then the .bat (as posted below)... but perhaps this has something to do with the error.

...
Score data
model: ac_rh_ls_lstm_01
WARNING:tensorflow:From E:\research\python_toolboxes\stanford-stages\inf_network.py:116: softmax_cross_entropy_with_logits (from tensorflow.python.ops.nn_ops) is deprecated and will be removed in a future version.
Instructions for updating:

Future major versions of TensorFlow will allow gradients to flow
into the labels input on backprop by default.

See @{tf.nn.softmax_cross_entropy_with_logits_v2}.

2020-02-16 21:49:01.572296: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
Hypnodensity pickled
2020-02-16 21:50:07.294226 | Predicting using: ac_rh_ls_lstm_01
Traceback (most recent call last):
  File "inf_narco_app.py", line 302, in <module>
    main(edfFile, jsonObj)
  File "inf_narco_app.py", line 124, in main
    print(narcoApp.get_diagnosis())
  File "inf_narco_app.py", line 185, in get_diagnosis
    prediction = self.get_narco_prediction()
  File "inf_narco_app.py", line 242, in get_narco_prediction
    m = gpf.saver.Saver().load(
AttributeError: module 'gpflow' has no attribute 'saver'
Mensen commented 4 years ago

So I looked into the version of gpflow that had been installed and it was 1.1 ... so I upgraded to 1.3 and no longer received this error...

Note that the installation guide says to install gpflow 1.2 but, at least on conda, this doesn't seem to be available as 1.1 goes directly to 1.3

Instead though I get:

OSError: Unable to create file (unable to open file: name = './ml/gp\ac_rh_ls_lstm_01\ac_rh_ls_lstm_01_fold01.gpm', errno = 2, error message = 'No such file or directory', flags = 15, o_flags = 502)

But the hypnogram text file is created so that's all I really need.

Perhaps this has to do with another bug I'll post another issue for.