Giter Club home page Giter Club logo

Comments (17)

mchinen avatar mchinen commented on May 28, 2024 6

Yes, this is a good feature. Adding python bindings is planned, and would be a first step in that direction.

from visqol.

mchinen avatar mchinen commented on May 28, 2024 6

Just a heads up I'm working on numpy and protobuf compatible bindings via pybind11, I hope to push to visqol after sorting out some remaining issues. That would be the precursor to the pip installable package.

from visqol.

jonashaag avatar jonashaag commented on May 28, 2024 2

I have built and containerised ViSQOL v3 here: https://hub.docker.com/r/jonashaag/visqol

from visqol.

jonashaag avatar jonashaag commented on May 28, 2024 2

If anyone wants to reproduce the build, here's what I'm using:

Build ViSQOL:

FROM ubuntu:18.04

RUN apt update \
 && apt -y install curl gnupg \
 && curl https://bazel.build/bazel-release.pub.gpg | apt-key add - \
 && echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list \
 && apt update && apt -y install git bazel libboost-all-dev
RUN git clone https://github.com/google/visqol \
 && cd visqol \
 && bazel build :visqol -c opt

Extract binaries from container:

docker cp <container id>:/visqol/bazel-bin/visqol visqol
docker cp <container id>:/visqol/model model

Build final image:

FROM ubuntu:18.04

COPY visqol /visqol/
COPY model /visqol/model/

WORKDIR /visqol
ENTRYPOINT ["./visqol"]

from visqol.

mchinen avatar mchinen commented on May 28, 2024 2

Incremental progress: pull request #26 is the pybind11 ViSQOL-side code to run as python. It won't be functional until some changes land in pybind11 repos for abseil/protobuf, but you can take a look as a preview. An interesting feature is that it allows using ViSQOL with numpy and you can use the return protobufs or status automatically.

from visqol.

mchinen avatar mchinen commented on May 28, 2024 2

Sorry for the delay. The current status is that we have this working internally, but I am working with the owners of https://github.com/pybind/pybind11_abseil and https://github.com/pybind/pybind11_protobuf. It's taking a bit to work out the kinks since this is the first external launch of pybind11 for those frameworks, so some general issues need to be resolved first.

from visqol.

mchinen avatar mchinen commented on May 28, 2024 2

#66 just merged and has python support (see tests/visqol_lib_py_test.py for examples). So far it only works on linux and mac. (I put some effort into Windows, so it builds but fails to import). This is not a pip-installable package, but presumably this can be used for that.

Thank you @yuribondarenko for the interim python support.

from visqol.

mpariente avatar mpariente commented on May 28, 2024 1

Great !
Do you have any idea of the timeline for that?

from visqol.

turian avatar turian commented on May 28, 2024 1

Any update on this?

from visqol.

margaritageleta avatar margaritageleta commented on May 28, 2024 1

Hi, any update on visqol as python lib? Thaanks

from visqol.

iver56 avatar iver56 commented on May 28, 2024

Since the official python bindings are not ready yet, I made a makeshift python wrapper that uses jonashaag's visqol docker image. It's not very fast, and it's not glamorous, but it works. Check out the python snippet here:

https://gist.github.com/iver56/02daea5f35db744d21bdad2d25c30e22

Hopefully the official python bindings (with less overhead) will be available soon.

from visqol.

mchinen avatar mchinen commented on May 28, 2024

Thanks @iver56 that's quite interesting, and I hope that unblocks some people.

The original plan was to use pybind11 for ViSQOL. Sorry that is taking so much longer than planned. This is implemented and works internally, but the github version is still not yet pushed - there is currently support for abseil, but not protobuf (https://github.com/pybind/pybind11_protobuf). However, it is in development.

from visqol.

turian avatar turian commented on May 28, 2024

Docker install for now?

from visqol.

yuribondarenko avatar yuribondarenko commented on May 28, 2024

I've updated python bindings implementation and fixed Bazel builds for it here #59. So far it works only for Linux. One can build a shared object with bazel build -c opt //python:pyvisqol.so. Then use it as a python package (either move it or set PYTHONPATH to the folder with .so). From python:

import pyvisqol
visqol = pyvisqol.ViSQOL("path/to/libsvm_nu_svr_model.txt")  # check usage for more options
# load reference ref and degraded audio deg as a list of floats (1D numpy arrays are also supported)
score = visqol.run(ref, ref_sr, deg, deg_sr)
# or use files directly
score = visqol.run("path/to/reference.wav", "path/to/degraded.wav")

from visqol.

deyibo avatar deyibo commented on May 28, 2024

So it can't works for windows, what a pity. :(

from visqol.

mchinen avatar mchinen commented on May 28, 2024

To be clear, Windows works with the normal C++ usage, but the python support is not yet there. Windows python doesn't work because the pybind11 support was not yet implemented upstream AFAICT. This is not ideal but the other option would be to delay the mac and linux python versions until this was addressed, so I chose to release as is. If anyone wants to contribute upstream, Windows python support is a great place to make an impact in pybind11_bazel/pybind11_protobuf/pybind11_absl.

from visqol.

mchinen avatar mchinen commented on May 28, 2024

See #81 which was just merged for a local solution.

from visqol.

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.