Commit 0f627e59 authored by Pavel KORSHUNOV's avatar Pavel KORSHUNOV

remove dependency on tensorflow

parent 0a193444
Pipeline #9326 passed with stages
in 10 minutes and 44 seconds
......@@ -5,12 +5,10 @@
from bob.pad.base.algorithm import Algorithm
import numpy
from bob.learn.tensorflow.network.SequenceNetwork import SequenceNetwork
from bob.learn.tensorflow.datashuffler import DiskAudio
import bob.io.base
import tensorflow as tf
# import tensorflow as tf
import logging
......@@ -31,7 +29,7 @@ class TensorflowAlgo(Algorithm):
requires_projector_training=False,
)
self.data_reader = DiskAudio([0], [0])
self.data_reader = None
# self.session = tf.Session()
self.dnn_model = None
......@@ -46,6 +44,7 @@ class TensorflowAlgo(Algorithm):
def load_projector(self, projector_file):
logger.info("Loading pretrained model from {0}".format(projector_file))
from bob.learn.tensorflow.network.SequenceNetwork import SequenceNetwork
self.dnn_model = SequenceNetwork()
# self.dnn_model.load_hdf5(bob.io.base.HDF5File(projector_file), shape=[1, 6560, 1])
self.dnn_model.load(projector_file, True)
......@@ -53,6 +52,9 @@ class TensorflowAlgo(Algorithm):
def project_feature(self, feature):
logger.debug(" .... Projecting %d features vector" % feature.shape[0])
from bob.learn.tensorflow.datashuffler import DiskAudio
if not self.data_reader:
self.data_reader = DiskAudio([0], [0])
frames, labels = self.data_reader.extract_frames_from_wav(feature, 0)
frames = numpy.asarray(frames)
logger.debug(" .... And %d frames are extracted to pass into DNN model" % frames.shape[0])
......
......@@ -5,14 +5,11 @@
"""Features for face recognition"""
import numpy
import bob.io.base
# import bob.io.base
from bob.bio.base.extractor import Extractor
from bob.learn.tensorflow.network import SequenceNetwork
from bob.learn.tensorflow.utils import Session
from bob.learn.tensorflow.datashuffler import DiskAudio
import bob.io.base
import bob.ip.base
# import bob.io.base
# import bob.ip.base
import logging
......@@ -44,7 +41,7 @@ class AudioTFExtractor(Extractor):
# self.session = Session.instance().session
self.feature_layer = feature_layer
self.data_reader = DiskAudio([0], [0])
self.data_reader = None
self.dnn_model = None
......@@ -55,6 +52,10 @@ class AudioTFExtractor(Extractor):
rate = input_data[0]
wav_sample = input_data[1]
from bob.learn.tensorflow.datashuffler import DiskAudio
if not self.data_reader:
self.data_reader = DiskAudio([0], [0])
logger.debug(" .... Extracting frames on the fly from %d length sample" % wav_sample.shape[0])
frames, labels = self.data_reader.extract_frames_from_wav(wav_sample, 0)
frames = numpy.asarray(frames)
......@@ -69,6 +70,7 @@ class AudioTFExtractor(Extractor):
def load(self, extractor_file):
logger.info("Loading pretrained model from {0}".format(extractor_file))
from bob.learn.tensorflow.network import SequenceNetwork
self.dnn_model = SequenceNetwork(default_feature_layer=self.feature_layer)
# self.dnn_model.load_hdf5(bob.io.base.HDF5File(extractor_file), shape=[1, 6560, 1])
self.dnn_model.load(extractor_file, clear_devices=True)
......
......@@ -6,6 +6,7 @@
parts = scripts
eggs = bob.pad.voice
bob.db.base
bob.bio.base
bob.bio.spear
bob.bio.gmm
......@@ -14,7 +15,6 @@ eggs = bob.pad.voice
bob.db.asvspoof2017
bob.db.avspoof
bob.db.voicepa
bob.learn.tensorflow
bob.db.cpqd_replay
gridtk
......@@ -23,15 +23,15 @@ extensions = bob.buildout
auto-checkout = *
develop = src/bob.bio.spear
src/bob.db.base
src/bob.bio.gmm
src/bob.db.asvspoof2017
src/bob.db.asvspoof
src/bob.db.avspoof
src/bob.db.voicepa
src/bob.db.cpqd_replay
src/bob.pad.base
src/bob.bio.base
src/bob.learn.tensorflow
src/bob.pad.base
.
; options for bob.buildout
......@@ -40,6 +40,7 @@ verbose = true
newest = false
[sources]
bob.db.base = git git@gitlab.idiap.ch:bob/bob.db.base.git
bob.bio.gmm = git git@gitlab.idiap.ch:bob/bob.bio.gmm.git
bob.db.asvspoof2017 = git git@gitlab.idiap.ch:bob/bob.db.asvspoof2017.git
bob.db.avspoof = git git@gitlab.idiap.ch:bob/bob.db.avspoof.git
......@@ -47,7 +48,6 @@ bob.db.asvspoof = git git@gitlab.idiap.ch:bob/bob.db.asvspoof.git
bob.bio.base = git git@gitlab.idiap.ch:bob/bob.bio.base.git
bob.pad.base = git git@gitlab.idiap.ch:bob/bob.pad.base.git
bob.db.voicepa = git git@gitlab.idiap.ch:bob/bob.db.voicepa.git
bob.learn.tensorflow = git branch=epoch git@gitlab.idiap.ch:bob/bob.learn.tensorflow.git
bob.bio.spear = git git@gitlab.idiap.ch:bob/bob.bio.spear.git
bob.db.cpqd_replay = git git@gitlab.idiap.ch:bob/bob.db.cpqd_replay.git
......
......@@ -6,4 +6,3 @@ bob.bio.spear
bob.bio.gmm
bob.ap
bob.io.base
bob.learn.tensorflow
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment