Re: [bob-devel] What is input data in " "?

Skip to first unread message

Amir Mohammadi

Aug 31, 2020, 11:59:06 AM8/31/20
to, bob-devel

I think using the Python API is the best approach rather using the  script.
What you provided as code should work, I think.
I cannot see what went wrong from your report as you replaced the traceback with ... which
is not helpful.

Could you please send a complete code example that I can reproduce your error on my machine?

On Aug 25 2020, at 5:06 am, 박준우 <> wrote:
Hi, i 'm currently looking for a way to preprocess a single file ( .wav)
so i found the "", but i don't know what the input file is required here.

first try, -p energy-2gauss -i /path/wav.wav -o /home/myhome/test.hdf5
RuntimeError: File - constructor: C++ exception caught: 'unregistered extension: .wav'

second try, -p filename -i /path/wav.wav -o /home/myhome/test.hdf5

so i'm written in code.

preprocessor = utils.load_resource("energy-2gauss", "preprocessor")
data = preprocessor.read_original_data(BioFile(1,"wavfile",2), "/home/myhome/", ".wav")
preprocessed = preprocessor(data, None)
TypeError: only size-1 arrays can be converted to Python scalars.

I don't know how to use this "".

-- You received this message because you are subscribed to the Google Groups bob-devel group. To post to this group, send email to To unsubscribe from this group, send email to For more options, visit this group at or directly the project website at
You received this message because you are subscribed to the Google Groups "bob-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to


Sep 17, 2020, 4:40:17 AM9/17/20
to bob-devel
hello, sorry for the late reply.

i  solved the above problem. the cause was 'bio_object' parameter. 

i used 'BioFile' object , but it was not an object suitable for 'Spear'
an object suitable for spear is 'AudioBioFile' object.

i attach a part of the code that i solved.

class Bobspear(object):

def __init__(self, audio_name, directory="./"):
self.audio_name = audio_name = directory
self.preprocessor, self.extractor, self.algorithm = self._load_resource()
self.init_time = time.time()

def _load_resource(self):

preprocessor = utils.load_resource("energy-2gauss", "preprocessor")
extractor = utils.load_resource("mfcc-60", "extractor")
algorithm = utils.load_resource("gmm-voxforge", "algorithm")
algorithm.load_projector( + TEMP_PATH +"Projector.hdf5")
return preprocessor, extractor, algorithm

def _get_preprocessed_data(self, bio_object, directory, extension=".wav"):
preprocessed = self.preprocessor.read_original_data(bio_object, directory, extension)
return preprocessed

def _write_feature(self, anotations=None):
preprocessed = self._get_preprocessed_data(AudioBioFile(1, self.audio_name, self.audio_name),
extracted = self.extractor(self.preprocessor(preprocessed, anotations))

def _compute_score(self):
models, probes = {}, {}
models_list = list()
model_files = [ + MODEL_PATH + dir for dir in os.listdir( + MODEL_PATH)]
probe_files = [ + "output.hdf5"]

for m in model_files:
models[m] = self.algorithm.read_model(m)
for p in probe_files:
probes[p] = self.extractor.read_feature(p)
for p in probe_files:
probes[p] = self.algorithm.project(probes[p])

result = 0.0
for p in probe_files:
for m in model_files:
score = self.algorithm.score(models[m], probes[p])
result = score if score > result else result

return result

the result of this code return scores for one wave file(probe file).

thank you for your reply
2020년 9월 1일 화요일 오전 12시 59분 6초 UTC+9에님이 작성:
Reply all
Reply to author
0 new messages