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

An Error occurred when using 'ut predict' & 'ut evaluate' ( code updated on June 21st) #33

Closed
ljyljy opened this issue Jun 29, 2021 · 6 comments

Comments

@ljyljy
Copy link

ljyljy commented Jun 29, 2021

I was able to run through predict.py a long time ago, but now the errors listed as follows occurred, and I am very confused about this.

The code I used was the version updated on June 21st.
When I used 'ut predict', I found the following error:
1. Report an error

TypeError: init() got an unexpected keyword argument'warnings_file'

By annotating the following code in bin/evaluate.py, I encountered the second error:
# warnings_file=warnings_name,

2. This error only occurred when using the newest code(updated on June 14 later):

Logged by: 'run_pred' in 'predict.py'

PREDICTING ON 2 STUDIES
Traceback (most recent call last):
  File "/export/ljy/U-Time/utime/dataset/sleep_study/sleep_study.py", line 410, in load
    self._load()
  File "/export/ljy/U-Time/utime/dataset/sleep_study/sleep_study.py", line 339, in _load
    self._psg, header = self._load_with_any_in(self._try_channels)
  File "/export/ljy/U-Time/utime/dataset/sleep_study/sleep_study.py", line 311, in _load_with_any_in
    header_file_path=self.header_file_path)
  File "/export/ljy/U-Time/utime/io/high_level_file_loaders.py", line 73, in load_psg
    check_duplicates=True
  File "/export/ljy/U-Time/utime/io/channels/utils.py", line 87, in get_org_include_exclude_channel_montages
    check_duplicate_channels(load_channels, channels_in_file, raise_or_warn="raise")
  File "/export/ljy/U-Time/utime/io/channels/utils.py", line 22, in check_duplicate_channels
    channels = ChannelMontageTuple(channels, relax=True)
  File "/export/ljy/U-Time/utime/io/channels/channels.py", line 166, in __new__
    channels, type(channels)))
TypeError: Input to ChannelMontageTuple should be a list, tuple or ndarray of channel names or ChannelMontage objects. Got None (type <class 'NoneType'>).

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/export/anaconda3/envs/ljy_u-sleep2/bin/ut", line 33, in <module>
    sys.exit(load_entry_point('utime', 'console_scripts', 'ut')())
  File "/export/ljy/U-Time/utime/bin/ut.py", line 71, in entry_func
    mod.entry_func(script_args + help_agrs)
  File "/export/ljy/U-Time/utime/bin/predict.py", line 394, in entry_func
    run(parser.parse_args(args))
  File "/export/ljy/U-Time/utime/bin/predict.py", line 388, in run
    logger=logger)
  File "/export/ljy/U-Time/utime/bin/predict.py", line 300, in run_pred
    seq = get_sequencer(dataset, hparams)
  File "/export/ljy/U-Time/utime/bin/evaluate.py", line 374, in get_sequencer
    require_all_loaded=False)
  File "/export/ljy/U-Time/utime/sequences/utils.py", line 82, in get_batch_sequence
    data_per_epoch, n_channels = infer_dpe_and_chans(dataset_queue)
  File "/export/ljy/U-Time/utime/sequences/utils.py", line 56, in infer_dpe_and_chans
    with dataset_queue.get_random_study() as sleep_study:
  File "/export/anaconda3/envs/ljy_u-sleep2/lib/python3.7/contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "/export/ljy/U-Time/utime/dataset/queue/lazy_queue.py", line 28, in get_random_study
    with study.loaded_in_context():
  File "/export/anaconda3/envs/ljy_u-sleep2/lib/python3.7/contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "/export/ljy/U-Time/utime/dataset/sleep_study/abc_sleep_study.py", line 157, in loaded_in_context
    self.load()
  File "/export/ljy/U-Time/utime/dataset/sleep_study/sleep_study.py", line 415, in load
    study_id=self.identifier) from e
utime.errors.CouldNotLoadError: Unexpected load error for sleep study tp026536b7_b8d5_44a5_adc6_87617520d5f2. Please refer to the above traceback.

3、Similarly, An Error occurred when using 'ut evaluate' :

Logged by: 'run_pred_and_eval' in 'evaluate.py'

PREDICTING ON 2 STUDIES
Setting augmenter: RegionalErase({'min_region_fraction': 0.001, 'max_region_fraction': 0.33, 'log_sample': True, 'apply_prob': 0.1})
Setting augmenter: ChannelDropout({'drop_fraction': 0.5, 'apply_prob': 0.1})
Traceback (most recent call last):
  File "/export/anaconda3/envs/ljy_u-sleep2/bin/ut", line 33, in <module>
    sys.exit(load_entry_point('utime', 'console_scripts', 'ut')())
  File "/export/ljy/U-Time0/utime/bin/ut.py", line 71, in entry_func
    mod.entry_func(script_args + help_agrs)
  File "/export/ljy/U-Time0/utime/bin/evaluate.py", line 542, in entry_func
    run(parser.parse_args(args))
  File "/export/ljy/U-Time0/utime/bin/evaluate.py", line 534, in run
    logger=logger)
  File "/export/ljy/U-Time0/utime/bin/evaluate.py", line 403, in run_pred_and_eval
    dice_eval_df = get_eval_df(seq)
  File "/export/ljy/U-Time0/utime/evaluation/dataframe.py", line 6, in get_eval_df
    ids = [ss.identifier for ss in sequencer.pairs]
AttributeError: 'BatchSequence' object has no attribute 'pairs'

Could some operating errors or code problems cause the above situation?
thx a lot!

@perslev
Copy link
Owner

perslev commented Jun 30, 2021

Hi!

Thanks for reporting these errors. I am busy these next few days, but will look into it asap. In the meantime, could you please try and remove the package and install it again according to these instructions:
https://github.com/perslev/U-Time#installation-guide

Your first error in particular seems to be related to an outdated version of the mpunet requirement.

Cheers

@ljyljy
Copy link
Author

ljyljy commented Jul 6, 2021

Thx again!!!
You may finish your work on hand first. ^^

@perslev
Copy link
Owner

perslev commented Jul 21, 2021

Hi!

Sorry for my very late reply. I believe I have managed to solve all three issues.

  1. Please install mpunet version 0.2.12 with pip install mpunet==0.2.12 --no-deps

  2. Fixed in 53c7ae0.

  3. Fixed in 530edb9

A few other minor changes have also been made. In all, please pull the latest version and let me know if you still experience these or any other issues :)

Cheers,
Mathias

@ljyljy
Copy link
Author

ljyljy commented Jul 21, 2021

Hi! Thank you for your reply and the code modification!
After the code is modified, the commands 'ut predict' and 'ut evaluate' have been executed successfully. ^^

In addition, I tried the 'ut extract' command and reported a minor error as follows:
(But the old version updated before June 21st can be executed successfully)
clipboard

thx again!! :)

@perslev
Copy link
Owner

perslev commented Jul 23, 2021

Great that the original issues were solved, and thanks for repoting this new error as well! I am currently on vacation, but I will look into it once as I am back in about 2 weeks.

Cheers,
Mathias

@perslev
Copy link
Owner

perslev commented Jul 23, 2021

Nevermind, this was actually relatively straight forward and should be fixed in 492dce9.

Please let me know if that solves you issue.

Cheers,
Mathias

@perslev perslev closed this as completed Jul 23, 2021
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