Code Monkey home page Code Monkey logo

Comments (2)

dimang777 avatar dimang777 commented on June 11, 2024

I simply didn't specify the correct path with the data files. Once I downloaded the QT database and specified the correct path, it worked.
But I have another problem now. After I built the model and saved it as a .dll file, I used it to predict, but it showed another error (the same error as before).

Code:

from cardio import EcgDataset
from cardio.pipelines import hmm_predict_pipeline
import warnings
warnings.filterwarnings('ignore')

eds = EcgDataset(path="C:\PhysioNetQT_DataB\cardio\cardio\tests\data\A*.hea", no_ext=True, sort=True)
batch = (eds >> hmm_predict_pipeline("C:\PhysioNetQT_DataB\model_dump.dll", annot="hmm_annotation")).next_batch()

batch.show_ecg("A00001", start=10, end=15, annot="hmm_annotation")

print("Heart rate: {0} bpm".format(int(.5 + batch["A00001"].meta["hr"])))

Error:
batch = (eds >> hmm_predict_pipeline("C:\PhysioNetQT_DataB\model_dump.dll", annot="hmm_annotation")).next_batch()

Traceback (most recent call last):

File "", line 1, in
batch = (eds >> hmm_predict_pipeline("C:\PhysioNetQT_DataB\model_dump.dll", annot="hmm_annotation")).next_batch()

File "C:\Anaconda3\lib\site-packages\cardio\dataset\dataset\pipeline.py", line 1057, in next_batch
batch_res = self.next_batch(*self._lazy_run[0], **self._lazy_run[1])

File "C:\Anaconda3\lib\site-packages\cardio\dataset\dataset\pipeline.py", line 1062, in next_batch
batch_res = next(self._batch_generator)

File "C:\Anaconda3\lib\site-packages\cardio\dataset\dataset\pipeline.py", line 1033, in gen_batch
for batch in batch_generator:

File "C:\Anaconda3\lib\site-packages\cardio\dataset\dataset\base.py", line 162, in gen_batch
for ix_batch in self.index.gen_batch(batch_size, shuffle, n_epochs, drop_last):

File "C:\Anaconda3\lib\site-packages\cardio\dataset\dataset\dsindex.py", line 276, in gen_batch
batch = self.next_batch(batch_size, shuffle, n_epochs, drop_last, iter_params)

File "C:\Anaconda3\lib\site-packages\cardio\dataset\dataset\dsindex.py", line 250, in next_batch
return self.create_batch(rest_items, pos=True)

File "C:\Anaconda3\lib\site-packages\cardio\dataset\dataset\dsindex.py", line 292, in create_batch
batch = self.subset_by_pos(_batch_indices)

File "C:\Anaconda3\lib\site-packages\cardio\dataset\dataset\dsindex.py", line 80, in subset_by_pos
return self.index[pos]

TypeError: only integer scalar arrays can be converted to a scalar index

This is the same error I got when there was no file to load. I checked the directory and it's correct and files are all there. Any advice would be much appreciated.

from cardio.

dimang777 avatar dimang777 commented on June 11, 2024

I think it was file name/path issue as well. It's been fixed.

from cardio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.