Giter Club home page Giter Club logo

Comments (12)

bhargavravat avatar bhargavravat commented on June 15, 2024

By reading few blogs I found that this error has something to do with cuda context and this can be solved by

saving the CUDA context.
Issue here is CUDA context refreshed and mixed up with other applications.

Can you help me out now?

from insightface-rest.

SthPhoenix avatar SthPhoenix commented on June 15, 2024

Could you please provide more info on how image is sent and received?

from insightface-rest.

bhargavravat avatar bhargavravat commented on June 15, 2024

I am connected to a server !

Server is sending me an image in byte array format.

Then I am converting that byte array into numpy array and then processing it further.

I am only receiving image , not sending!

from insightface-rest.

SthPhoenix avatar SthPhoenix commented on June 15, 2024

It's hard to tell which reason might cause this exception without additional info, but I think it's mostly connected to the way you read the image before feeding it for inference.
I have tested this code with reading images from rabbitmq query, and from fastapi endpoint, which is default behavior of this project, and haven't got such exceptions.
If you could provide minimal reproducible example I could try checking it.

from insightface-rest.

SthPhoenix avatar SthPhoenix commented on June 15, 2024

Could you also provide minimum server example? For testing full cycle.

EDIT: Have you tried to save image decoded by opencv to disk with cv.imwrite?

from insightface-rest.

bhargavravat avatar bhargavravat commented on June 15, 2024

Yes , image is perfect the way it should be !
There is no issues with the input image that's for sure ! I have cross checked with storing that image in local storage and also checked it , it is how it should be !!

from insightface-rest.

bhargavravat avatar bhargavravat commented on June 15, 2024

Found the solution!!
Closing it

from insightface-rest.

SthPhoenix avatar SthPhoenix commented on June 15, 2024

Great news, @bhargavravat! Could you please post your solution? I'll apply it to master branch if it doesn't conflict with FastAPI.

from insightface-rest.

bhargavravat avatar bhargavravat commented on June 15, 2024

I have modified trt_loader.py (/app/modules/model_zoo/exec_backends/trt_loader.py)

Attaching it as .txt format

trt_loader.txt

from insightface-rest.

SthPhoenix avatar SthPhoenix commented on June 15, 2024

I have tested your solution with /src/converters/pipeline_tester.py, but it fails with following error:

PyCUDA ERROR: The context stack was not empty upon module cleanup.

I was able to fix it by replacing line 84:

self.cuda_ctx = cuda_ctx

with:

device = cuda.Device(0)  # enter your gpu id here
ctx = device.make_context()
self.cuda_ctx = ctx

This worked, but caused excessive GPU RAM usage, about 1GB

from insightface-rest.

ThiagoMateo avatar ThiagoMateo commented on June 15, 2024

hello @SthPhoenix how to create 1 engine (ex face detection) serve for more than 2 camera using threading?
i tried, but i got confused outputs between these thread.

from insightface-rest.

SthPhoenix avatar SthPhoenix commented on June 15, 2024

Hi @ThiagoMateo ! As I have said before, this use case is not tested, for now you can use provided rest API in your application.
In future versions I'm planning to add full support of Triton Inference Server, which will give you ability to serve single model for multiple threads.

from insightface-rest.

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.