怎么用gpu跑python程序_如何在GPU支持下运行python代码

I have created a flask service for accepting requests with camera URLs as parameters for finding objects(table, chair etc...) in the camera frame. I have written code in flask for accepting POST requests.

@app.route('/rest/detectObjects', methods=['GET','POST'])

def detectObjects()

...

json_result = function_call_for_detecting_objects()

...

return

In the function, its loads the tf model for object detection and returns the result. A large amount of request needs to be processed simultaneously by the flask server. So I need to execute the function using GPU as the camera access time and image processing for object detection takes much time and CPU utilization. Have a 4 GB GeForce GTX 1050 Ti/PCIe/SSE2. How can I make my python script to make use of GPU for this?

解决方案

Installing tensorflow gpu will make the script to detect gpu automatically. if it is not detecting the gpu, check the driver versions(Cuda and cudnn). If no version mismatch or errors occur, then the script can identify the gpu present and will run utilizing the gpu.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值