helme / ecg_ptbxl_benchmarking

Public repository associated with "Deep Learning for ECG Analysis: Benchmarks and Insights from PTB-XL"
GNU General Public License v3.0
195 stars 86 forks source link

Everything in this repository isn't working at all #25

Closed hawkiyc closed 4 months ago

hawkiyc commented 1 year ago

I am trying to reproduce your research, but in the end, I only get great disappointment and numerous errors.

Initially, I attempted to import env from the .yml file you provided. Yet, I got the following ResolvePackageNotFound error.

So, I removed the above packages in the .yml file and sought to bypass this issue. Again, unfortunately, more errors popped out. Your environment has infinite package conflict that is impossible to solve.

Following link detailing the conflict error while importing your env, there is too much content that I can't even post here. Conflict Info.

I have never ever seen so many conflicts in any environment till your environment. Be honestly, I even question whether any script can be executed properly in such a poor environment.

Anyway, I still have not given up. I clone my own environment and pip install the fastai librariy.

Then I stuck due to _pickle.UnpicklingError which I mentioned in #24 Moreover, not only reproduce_results.py can't run correctly, but also Finetuning-Example.ipynb not working.

I got the following error while finetuning. 螢幕擷取畫面 2023-05-26 192620 And here is the full text for jpy kernel output:

OSError                                   Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_856\2871713832.py in <cell line: 1>()
----> 1 model.fit(X_train, y_train, X_val, y_val)

D:\訓練模型暫存區\CVDs_with_xResnet\Original_Article_Source_Code\code\models\fastai_model.py in fit(self, X_train, y_train, X_val, y_val)
    280             learn.unfreeze()
    281             lr_find_plot(learn, self.outputfolder,"lr_find"+str(len(layer_groups)))
--> 282             learn.fit_one_cycle(self.epochs_finetuning,slice(lr/1000,lr/10))
    283             losses_plot(learn, self.outputfolder,"losses"+str(len(layer_groups)))
    284 

~\anaconda3\envs\env_ptbxl_benchmark\lib\site-packages\fastai\train.py in fit_one_cycle(learn, cyc_len, max_lr, moms, div_factor, pct_start, final_div, wd, callbacks, tot_epochs, start_epoch)
     21     callbacks.append(OneCycleScheduler(learn, max_lr, moms=moms, div_factor=div_factor, pct_start=pct_start,
     22                                        final_div=final_div, tot_epochs=tot_epochs, start_epoch=start_epoch))
---> 23     learn.fit(cyc_len, max_lr, wd=wd, callbacks=callbacks)
     24 
     25 def fit_fc(learn:Learner, tot_epochs:int=1, lr:float=defaults.lr,  moms:Tuple[float,float]=(0.95,0.85), start_pct:float=0.72,

~\anaconda3\envs\env_ptbxl_benchmark\lib\site-packages\fastai\basic_train.py in fit(self, epochs, lr, wd, callbacks)
    198         else: self.opt.lr,self.opt.wd = lr,wd
    199         callbacks = [cb(self) for cb in self.callback_fns + listify(defaults.extra_callback_fns)] + listify(callbacks)
--> 200         fit(epochs, self, metrics=self.metrics, callbacks=self.callbacks+callbacks)
    201 
    202     def create_opt(self, lr:Floats, wd:Floats=0.)->None:

~\anaconda3\envs\env_ptbxl_benchmark\lib\site-packages\fastai\basic_train.py in fit(epochs, learn, callbacks, metrics)
     97             cb_handler.set_dl(learn.data.train_dl)
     98             cb_handler.on_epoch_begin()
---> 99             for xb,yb in progress_bar(learn.data.train_dl, parent=pbar):
    100                 xb, yb = cb_handler.on_batch_begin(xb, yb)
    101                 loss = loss_batch(learn.model, xb, yb, learn.loss_func, learn.opt, cb_handler)

~\anaconda3\envs\env_ptbxl_benchmark\lib\site-packages\fastprogress\fastprogress.py in __iter__(self)
     48         except Exception as e:
     49             self.on_interrupt()
---> 50             raise e
     51 
     52     def update(self, val):

~\anaconda3\envs\env_ptbxl_benchmark\lib\site-packages\fastprogress\fastprogress.py in __iter__(self)
     39         if self.total != 0: self.update(0)
     40         try:
---> 41             for i,o in enumerate(self.gen):
     42                 if self.total and i >= self.total: break
     43                 yield o

~\anaconda3\envs\env_ptbxl_benchmark\lib\site-packages\fastai\basic_data.py in __iter__(self)
     73     def __iter__(self):
     74         "Process and returns items from `DataLoader`."
---> 75         for b in self.dl: yield self.proc_batch(b)
     76 
     77     @classmethod

~\anaconda3\envs\env_ptbxl_benchmark\lib\site-packages\torch\utils\data\dataloader.py in __iter__(self)
    439             return self._iterator
    440         else:
--> 441             return self._get_iterator()
    442 
    443     @property

~\anaconda3\envs\env_ptbxl_benchmark\lib\site-packages\torch\utils\data\dataloader.py in _get_iterator(self)
    386         else:
    387             self.check_worker_number_rationality()
--> 388             return _MultiProcessingDataLoaderIter(self)
    389 
    390     @property

~\anaconda3\envs\env_ptbxl_benchmark\lib\site-packages\torch\utils\data\dataloader.py in __init__(self, loader)
   1040             #     before it starts, and __del__ tries to join but will get:
   1041             #     AssertionError: can only join a started process.
-> 1042             w.start()
   1043             self._index_queues.append(index_queue)
   1044             self._workers.append(w)

~\anaconda3\envs\env_ptbxl_benchmark\lib\multiprocessing\process.py in start(self)
    119                'daemonic processes are not allowed to have children'
    120         _cleanup()
--> 121         self._popen = self._Popen(self)
    122         self._sentinel = self._popen.sentinel
    123         # Avoid a refcycle if the target function holds an indirect

~\anaconda3\envs\env_ptbxl_benchmark\lib\multiprocessing\context.py in _Popen(process_obj)
    222     @staticmethod
    223     def _Popen(process_obj):
--> 224         return _default_context.get_context().Process._Popen(process_obj)
    225 
    226 class DefaultContext(BaseContext):

~\anaconda3\envs\env_ptbxl_benchmark\lib\multiprocessing\context.py in _Popen(process_obj)
    325         def _Popen(process_obj):
    326             from .popen_spawn_win32 import Popen
--> 327             return Popen(process_obj)
    328 
    329     class SpawnContext(BaseContext):

~\anaconda3\envs\env_ptbxl_benchmark\lib\multiprocessing\popen_spawn_win32.py in __init__(self, process_obj)
     91             try:
     92                 reduction.dump(prep_data, to_child)
---> 93                 reduction.dump(process_obj, to_child)
     94             finally:
     95                 set_spawning_popen(None)

~\anaconda3\envs\env_ptbxl_benchmark\lib\multiprocessing\reduction.py in dump(obj, file, protocol)
     58 def dump(obj, file, protocol=None):
     59     '''Replacement for pickle.dump() using ForkingPickler.'''
---> 60     ForkingPickler(file, protocol).dump(obj)
     61 
     62 #

OSError: [Errno 22] Invalid argument

Besides that, I built xresnet model from scratch too. I get close validation loss to your results, nevertheless, confusion matrix for each super-diagnosis showed poor F1 score. And I have no clue how you get such a high auc score.

helme commented 4 months ago

Hi @hawkiyc , I'm very sorry you've had bad experience while using this repo. Unfortunately, I'm not able to resolve your issues here, since I don't know anything about your specific settings. Nevertheless, there is no reason to be rude here! I'm totally aware, that the current status of this repo is far behind current best practives, but since my research moved on, I don't have time to re-write the codebase. Sorry for that. Nevertheless, I think most of the people using this repo haven't encountered your issues...