Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.ap
Commits
799cd65f
Commit
799cd65f
authored
May 26, 2014
by
André Anjos
💬
Browse files
xbob -> bob
parent
9df3da68
Changes
22
Hide whitespace changes
Inline
Side-by-side
.travis.yml
View file @
799cd65f
...
...
@@ -31,8 +31,8 @@ install:
-
"
python
bootstrap.py"
-
"
CFLAGS=-coverage
./bin/buildout"
script
:
-
"
./bin/python
-c
'from
x
bob.ap
import
get_config;
print(get_config())'"
-
"
./bin/coverage
run
--source=
x
bob.ap
./bin/nosetests
-sv"
-
"
./bin/python
-c
'from
bob.ap
import
get_config;
print(get_config())'"
-
"
./bin/coverage
run
--source=bob.ap
./bin/nosetests
-sv"
-
"
./bin/sphinx-build
-b
doctest
doc
sphinx"
-
"
./bin/sphinx-build
-b
html
doc
sphinx"
after_success
:
...
...
MANIFEST.in
View file @
799cd65f
include LICENSE README.rst bootstrap.py buildout.cfg
recursive-include doc conf.py *.rst
recursive-include
x
bob *.cpp
recursive-include
x
bob/ap/data *.wav
recursive-include bob *.cpp
recursive-include bob/ap/data *.wav
README.rst
View file @
799cd65f
...
...
@@ -2,16 +2,16 @@
..
Andre
Anjos
<
andre
.
anjos
@
idiap
.
ch
>
..
Thu
30
Jan
08
:
46
:
53
2014
CET
..
image
::
https
://
travis
-
ci
.
org
/
bioidiap
/
x
bob
.
ap
.
svg
?
branch
=
master
:
target
:
https
://
travis
-
ci
.
org
/
bioidiap
/
x
bob
.
ap
..
image
::
https
://
coveralls
.
io
/
repos
/
bioidiap
/
x
bob
.
ap
/
badge
.
png
:
target
:
https
://
coveralls
.
io
/
r
/
bioidiap
/
x
bob
.
ap
..
image
::
http
://
img
.
shields
.
io
/
github
/
tag
/
bioidiap
/
x
bob
.
ap
.
png
:
target
:
https
://
github
.
com
/
bioidiap
/
x
bob
.
ap
..
image
::
http
://
img
.
shields
.
io
/
pypi
/
v
/
x
bob
.
ap
.
png
:
target
:
https
://
pypi
.
python
.
org
/
pypi
/
x
bob
.
ap
..
image
::
http
://
img
.
shields
.
io
/
pypi
/
dm
/
x
bob
.
ap
.
png
:
target
:
https
://
pypi
.
python
.
org
/
pypi
/
x
bob
.
ap
..
image
::
https
://
travis
-
ci
.
org
/
bioidiap
/
bob
.
ap
.
svg
?
branch
=
master
:
target
:
https
://
travis
-
ci
.
org
/
bioidiap
/
bob
.
ap
..
image
::
https
://
coveralls
.
io
/
repos
/
bioidiap
/
bob
.
ap
/
badge
.
png
:
target
:
https
://
coveralls
.
io
/
r
/
bioidiap
/
bob
.
ap
..
image
::
http
://
img
.
shields
.
io
/
github
/
tag
/
bioidiap
/
bob
.
ap
.
png
:
target
:
https
://
github
.
com
/
bioidiap
/
bob
.
ap
..
image
::
http
://
img
.
shields
.
io
/
pypi
/
v
/
bob
.
ap
.
png
:
target
:
https
://
pypi
.
python
.
org
/
pypi
/
bob
.
ap
..
image
::
http
://
img
.
shields
.
io
/
pypi
/
dm
/
bob
.
ap
.
png
:
target
:
https
://
pypi
.
python
.
org
/
pypi
/
bob
.
ap
=============================
Python
bindings
for
bob
.
ap
...
...
@@ -42,7 +42,7 @@ Testing
You can run a set of tests using the nose test runner::
$ nosetests -sv
x
bob.ap
$ nosetests -sv bob.ap
.. warning::
...
...
@@ -59,7 +59,7 @@ You can run our documentation tests using sphinx itself::
You can test overall test coverage with::
$ nosetests --with-coverage --cover-package=
x
bob.ap
$ nosetests --with-coverage --cover-package=bob.ap
The ``coverage`` egg must be installed for this to work properly.
...
...
x
bob/__init__.py
→
bob/__init__.py
View file @
799cd65f
File moved
x
bob/ap/__init__.py
→
bob/ap/__init__.py
View file @
799cd65f
File moved
x
bob/ap/ceps.cpp
→
bob/ap/ceps.cpp
View file @
799cd65f
...
...
@@ -5,11 +5,11 @@
* @brief Bindings to the base class bob::ap::Ceps
*/
#include
<
x
bob.blitz/cppapi.h>
#include
<
x
bob.blitz/cleanup.h>
#include
<bob.blitz/cppapi.h>
#include
<bob.blitz/cleanup.h>
#include
"types.h"
PyDoc_STRVAR
(
s_ceps_str
,
X
BOB_EXT_MODULE_PREFIX
".Ceps"
);
PyDoc_STRVAR
(
s_ceps_str
,
BOB_EXT_MODULE_PREFIX
".Ceps"
);
PyDoc_STRVAR
(
s_ceps_doc
,
"Ceps(sampling_frequency, [win_length_ms=20., [win_shift_ms=10., [n_filters=24, [n_ceps=19, [f_min=0., [f_max=4000., [delta_win=2, [pre_emphasis_coeff=0.95, [mel_scale=True, [dct_norm=True]]]]]]]]]]) -> new Ceps
\n
\
...
...
x
bob/ap/data/sample.wav
→
bob/ap/data/sample.wav
View file @
799cd65f
File moved
x
bob/ap/energy.cpp
→
bob/ap/energy.cpp
View file @
799cd65f
...
...
@@ -5,11 +5,11 @@
* @brief Bindings to the base class bob::ap::Energy
*/
#include
<
x
bob.blitz/cppapi.h>
#include
<
x
bob.blitz/cleanup.h>
#include
<bob.blitz/cppapi.h>
#include
<bob.blitz/cleanup.h>
#include
"types.h"
PyDoc_STRVAR
(
s_energy_str
,
X
BOB_EXT_MODULE_PREFIX
".Energy"
);
PyDoc_STRVAR
(
s_energy_str
,
BOB_EXT_MODULE_PREFIX
".Energy"
);
PyDoc_STRVAR
(
s_energy_doc
,
"Energy(sampling_frequency, [win_length_ms=20., [win_shift_ms=10.]]) -> new Energy
\n
\
...
...
x
bob/ap/frame_extractor.cpp
→
bob/ap/frame_extractor.cpp
View file @
799cd65f
...
...
@@ -5,11 +5,11 @@
* @brief Bindings to the base class bob::ap::FrameExtractor
*/
#include
<
x
bob.blitz/cppapi.h>
#include
<
x
bob.blitz/cleanup.h>
#include
<bob.blitz/cppapi.h>
#include
<bob.blitz/cleanup.h>
#include
"types.h"
PyDoc_STRVAR
(
s_frame_extractor_str
,
X
BOB_EXT_MODULE_PREFIX
".FrameExtractor"
);
PyDoc_STRVAR
(
s_frame_extractor_str
,
BOB_EXT_MODULE_PREFIX
".FrameExtractor"
);
PyDoc_STRVAR
(
s_frame_extractor_doc
,
"FrameExtractor(sampling_frequency, [win_length_ms=20., [win_shift_ms=10.]]) -> new FrameExtractor
\n
\
...
...
x
bob/ap/main.cpp
→
bob/ap/main.cpp
View file @
799cd65f
...
...
@@ -8,8 +8,8 @@
#ifdef NO_IMPORT_ARRAY
#undef NO_IMPORT_ARRAY
#endif
#include
<
x
bob.blitz/capi.h>
#include
<
x
bob.blitz/cleanup.h>
#include
<bob.blitz/capi.h>
#include
<bob.blitz/cleanup.h>
#include
"types.h"
static
PyMethodDef
module_methods
[]
=
{
...
...
@@ -21,7 +21,7 @@ PyDoc_STRVAR(module_docstr, "Bob audio processing toolkit");
#if PY_VERSION_HEX >= 0x03000000
static
PyModuleDef
module_definition
=
{
PyModuleDef_HEAD_INIT
,
X
BOB_EXT_MODULE_NAME
,
BOB_EXT_MODULE_NAME
,
module_docstr
,
-
1
,
module_methods
,
...
...
@@ -46,12 +46,12 @@ static PyObject* create_module (void) {
# if PY_VERSION_HEX >= 0x03000000
PyObject
*
m
=
PyModule_Create
(
&
module_definition
);
# else
PyObject
*
m
=
Py_InitModule3
(
X
BOB_EXT_MODULE_NAME
,
module_methods
,
module_docstr
);
PyObject
*
m
=
Py_InitModule3
(
BOB_EXT_MODULE_NAME
,
module_methods
,
module_docstr
);
# endif
if
(
!
m
)
return
0
;
auto
m_
=
make_safe
(
m
);
///< protects against early returns
if
(
PyModule_AddStringConstant
(
m
,
"__version__"
,
X
BOB_EXT_MODULE_VERSION
)
<
0
)
if
(
PyModule_AddStringConstant
(
m
,
"__version__"
,
BOB_EXT_MODULE_VERSION
)
<
0
)
return
0
;
/* register the types to python */
...
...
@@ -67,15 +67,15 @@ static PyObject* create_module (void) {
Py_INCREF
(
&
PyBobApCeps_Type
);
if
(
PyModule_AddObject
(
m
,
"Ceps"
,
(
PyObject
*
)
&
PyBobApCeps_Type
)
<
0
)
return
0
;
/* imports
x
bob.blitz C-API + dependencies */
if
(
import_
x
bob_blitz
()
<
0
)
return
0
;
/* imports bob.blitz C-API + dependencies */
if
(
import_bob_blitz
()
<
0
)
return
0
;
Py_INCREF
(
m
);
return
m
;
}
PyMODINIT_FUNC
X
BOB_EXT_ENTRY_NAME
(
void
)
{
PyMODINIT_FUNC
BOB_EXT_ENTRY_NAME
(
void
)
{
# if PY_VERSION_HEX >= 0x03000000
return
# endif
...
...
x
bob/ap/spectrogram.cpp
→
bob/ap/spectrogram.cpp
View file @
799cd65f
...
...
@@ -5,11 +5,11 @@
* @brief Bindings to the base class bob::ap::Spectrogram
*/
#include
<
x
bob.blitz/cppapi.h>
#include
<
x
bob.blitz/cleanup.h>
#include
<bob.blitz/cppapi.h>
#include
<bob.blitz/cleanup.h>
#include
"types.h"
PyDoc_STRVAR
(
s_spectrogram_str
,
X
BOB_EXT_MODULE_PREFIX
".Spectrogram"
);
PyDoc_STRVAR
(
s_spectrogram_str
,
BOB_EXT_MODULE_PREFIX
".Spectrogram"
);
PyDoc_STRVAR
(
s_spectrogram_doc
,
"Spectrogram(sampling_frequency, [win_length_ms=20., [win_shift_ms=10., [n_filters=24, [f_min=0., [f_max=4000., [pre_emphasis_coeff=0.95, [mel_scale=True]]]]]]]) -> new Spectrogram
\n
\
...
...
x
bob/ap/test_ceps.py
→
bob/ap/test_ceps.py
View file @
799cd65f
...
...
@@ -8,7 +8,7 @@ import os
import
numpy
import
pkg_resources
from
x
bob.sp
import
fft
from
bob.sp
import
fft
from
.
import
Ceps
from
.test_utils
import
*
...
...
x
bob/ap/test_energy.py
→
bob/ap/test_energy.py
View file @
799cd65f
File moved
x
bob/ap/test_spectrogram.py
→
bob/ap/test_spectrogram.py
View file @
799cd65f
File moved
x
bob/ap/test_utils.py
→
bob/ap/test_utils.py
View file @
799cd65f
...
...
@@ -10,7 +10,7 @@ import math
import
numpy
import
scipy.io.wavfile
from
x
bob.sp
import
fft
from
bob.sp
import
fft
def
read
(
filename
):
"""Read video.FrameContainer containing preprocessed frames"""
...
...
x
bob/ap/types.h
→
bob/ap/types.h
View file @
799cd65f
...
...
@@ -5,8 +5,8 @@
* @brief All types that need cross-compilation on different units
*/
#ifndef
X
BOB_AP_TYPES_H
#define
X
BOB_AP_TYPES_H
#ifndef BOB_AP_TYPES_H
#define BOB_AP_TYPES_H
#include
<bob/ap/FrameExtractor.h>
#include
<bob/ap/Energy.h>
...
...
@@ -53,4 +53,4 @@ typedef struct {
extern
PyTypeObject
PyBobApCeps_Type
;
//forward declaration
#endif
/*
X
BOB_AP_TYPES_H */
#endif
/* BOB_AP_TYPES_H */
x
bob/ap/version.cpp
→
bob/ap/version.cpp
View file @
799cd65f
...
...
@@ -19,8 +19,8 @@
#ifdef NO_IMPORT_ARRAY
#undef NO_IMPORT_ARRAY
#endif
#include
<
x
bob.blitz/capi.h>
#include
<
x
bob.blitz/cleanup.h>
#include
<bob.blitz/capi.h>
#include
<bob.blitz/cleanup.h>
static
int
dict_set
(
PyObject
*
d
,
const
char
*
key
,
const
char
*
value
)
{
PyObject
*
v
=
Py_BuildValue
(
"s"
,
value
);
...
...
@@ -96,10 +96,10 @@ static PyObject* numpy_version() {
}
/**
*
x
bob.blitz c/c++ api version
* bob.blitz c/c++ api version
*/
static
PyObject
*
x
bob_blitz_version
()
{
return
Py_BuildValue
(
"{ss}"
,
"api"
,
BOOST_PP_STRINGIZE
(
X
BOB_BLITZ_API_VERSION
));
static
PyObject
*
bob_blitz_version
()
{
return
Py_BuildValue
(
"{ss}"
,
"api"
,
BOOST_PP_STRINGIZE
(
BOB_BLITZ_API_VERSION
));
}
static
PyObject
*
build_version_dictionary
()
{
...
...
@@ -113,7 +113,7 @@ static PyObject* build_version_dictionary() {
if
(
!
dict_steal
(
retval
,
"Compiler"
,
compiler_version
()))
return
0
;
if
(
!
dict_steal
(
retval
,
"Python"
,
python_version
()))
return
0
;
if
(
!
dict_steal
(
retval
,
"NumPy"
,
numpy_version
()))
return
0
;
if
(
!
dict_steal
(
retval
,
"
x
bob.blitz"
,
x
bob_blitz_version
()))
return
0
;
if
(
!
dict_steal
(
retval
,
"bob.blitz"
,
bob_blitz_version
()))
return
0
;
if
(
!
dict_steal
(
retval
,
"Bob"
,
bob_version
()))
return
0
;
Py_INCREF
(
retval
);
...
...
@@ -131,7 +131,7 @@ PyDoc_STRVAR(module_docstr,
#if PY_VERSION_HEX >= 0x03000000
static
PyModuleDef
module_definition
=
{
PyModuleDef_HEAD_INIT
,
X
BOB_EXT_MODULE_NAME
,
BOB_EXT_MODULE_NAME
,
module_docstr
,
-
1
,
module_methods
,
...
...
@@ -144,27 +144,27 @@ static PyObject* create_module (void) {
# if PY_VERSION_HEX >= 0x03000000
PyObject
*
m
=
PyModule_Create
(
&
module_definition
);
# else
PyObject
*
m
=
Py_InitModule3
(
X
BOB_EXT_MODULE_NAME
,
module_methods
,
module_docstr
);
PyObject
*
m
=
Py_InitModule3
(
BOB_EXT_MODULE_NAME
,
module_methods
,
module_docstr
);
# endif
if
(
!
m
)
return
0
;
auto
m_
=
make_safe
(
m
);
///< protects against early returns
/* register version numbers and constants */
if
(
PyModule_AddStringConstant
(
m
,
"module"
,
X
BOB_EXT_MODULE_VERSION
)
<
0
)
if
(
PyModule_AddStringConstant
(
m
,
"module"
,
BOB_EXT_MODULE_VERSION
)
<
0
)
return
0
;
PyObject
*
externals
=
build_version_dictionary
();
if
(
!
externals
)
return
0
;
if
(
PyModule_AddObject
(
m
,
"externals"
,
externals
)
<
0
)
return
0
;
if
(
import_
x
bob_blitz
()
<
0
)
return
0
;
if
(
import_bob_blitz
()
<
0
)
return
0
;
Py_INCREF
(
m
);
return
m
;
}
PyMODINIT_FUNC
X
BOB_EXT_ENTRY_NAME
(
void
)
{
PyMODINIT_FUNC
BOB_EXT_ENTRY_NAME
(
void
)
{
# if PY_VERSION_HEX >= 0x03000000
return
# endif
...
...
buildout.cfg
View file @
799cd65f
...
...
@@ -4,25 +4,25 @@
[buildout]
parts = scripts
eggs =
x
bob.ap
extensions =
x
bob.buildout
eggs = bob.ap
extensions = bob.buildout
mr.developer
auto-checkout = *
develop = src/
x
bob.extension
src/
x
bob.blitz
src/
x
bob.sp
develop = src/bob.extension
src/bob.blitz
src/bob.sp
.
; options for
x
bob.buildout extension
; options for bob.buildout extension
debug = true
verbose = true
prefixes = /idiap/group/torch5spro/nightlies/last/bob/linux-x86_64-release
/Users/andre/work/bob/b/dbg/
[sources]
x
bob.extension = git https://github.com/bioidiap/
x
bob.extension
branch=prototype
x
bob.blitz = git https://github.com/bioidiap/
x
bob.blitz
x
bob.sp = git https://github.com/bioidiap/
x
bob.sp
bob.extension = git https://github.com/bioidiap/bob.extension
bob.blitz = git https://github.com/bioidiap/bob.blitz
bob.sp = git https://github.com/bioidiap/bob.sp
[scripts]
recipe =
x
bob.buildout:scripts
recipe = bob.buildout:scripts
doc/conf.py
View file @
799cd65f
...
...
@@ -58,12 +58,12 @@ source_suffix = '.rst'
master_doc
=
'index'
# General information about the project.
project
=
u
'
x
bob.ap'
project
=
u
'bob.ap'
import
time
copyright
=
u
'%s, Idiap Research Institute'
%
time
.
strftime
(
'%Y'
)
# Grab the setup entry
distribution
=
pkg_resources
.
require
(
'
x
bob.ap'
)[
0
]
distribution
=
pkg_resources
.
require
(
'bob.ap'
)[
0
]
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
...
...
@@ -129,7 +129,7 @@ if sphinx.__version__ >= "1.0":
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = '
x
bob_ap'
#html_short_title = 'bob_ap'
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
...
...
@@ -187,7 +187,7 @@ html_favicon = 'img/favicon.ico'
#html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename
=
'
x
bob_ap_doc'
htmlhelp_basename
=
'bob_ap_doc'
# -- Options for LaTeX output --------------------------------------------------
...
...
@@ -201,7 +201,7 @@ latex_font_size = '10pt'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents
=
[
(
'index'
,
'
x
bob_ap.tex'
,
u
'Bob Audio Processing Routines'
,
(
'index'
,
'bob_ap.tex'
,
u
'Bob Audio Processing Routines'
,
u
'Biometrics Group, Idiap Research Institute'
,
'manual'
),
]
...
...
@@ -241,7 +241,7 @@ rst_epilog = """
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages
=
[
(
'index'
,
'
x
bob_ap'
,
u
'Bob Audio Processing Documentation'
,
[
u
'Idiap Research Institute'
],
1
)
(
'index'
,
'bob_ap'
,
u
'Bob Audio Processing Documentation'
,
[
u
'Idiap Research Institute'
],
1
)
]
# Default processing flags for sphinx
...
...
doc/guide.rst
View file @
799cd65f
...
...
@@ -8,12 +8,12 @@
import sys
import math
import numpy
import
x
bob.ap
import bob.ap
import scipy.io.wavfile
from pkg_resources import resource_filename
wave_path = resource_filename('
x
bob.ap', os.path.join('data', 'sample.wav'))
wave_path = resource_filename('bob.ap', os.path.join('data', 'sample.wav'))
sys.stdout = open(os.devnull, 'w')
rate, signal = scipy.io.wavfile.read(str(wave_path))
...
...
@@ -66,7 +66,7 @@ LFCC and MFCC Extraction
~~~~~~~~~~~~~~~~~~~~~~~~
The LFCC and MFCC coefficients can be extracted from a audio signal by using
:py:func:`
x
bob.ap.Ceps`. To do so, several parameters can be precised by the
:py:func:`bob.ap.Ceps`. To do so, several parameters can be precised by the
user. Typically, these are precised in a configuration file. The following
values are the default ones:
...
...
@@ -84,13 +84,13 @@ values are the default ones:
>>> dct_norm = True # A factor by which the cepstral coefficients are multiplied
>>> mel_scale = True # Tell whether cepstral features are extracted on a linear (LFCC) or Mel (MFCC) scale
Once the parameters are precised, :py:func:`
x
bob.ap.Ceps` can be called as
Once the parameters are precised, :py:func:`bob.ap.Ceps` can be called as
follows:
.. doctest:: aptest
:options: +NORMALIZE_WHITESPACE
>>> c =
x
bob.ap.Ceps(rate, win_length_ms, win_shift_ms, n_filters, n_ceps, f_min, f_max, delta_win, pre_emphasis_coef, mel_scale, dct_norm)
>>> c = bob.ap.Ceps(rate, win_length_ms, win_shift_ms, n_filters, n_ceps, f_min, f_max, delta_win, pre_emphasis_coef, mel_scale, dct_norm)
>>> signal = numpy.cast['float'](signal) # vector should be in **float**
>>> mfcc = c(signal)
>>> print(len(mfcc))
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment