Comments (15)
You can adjust the input image resolution in Webcam class
class Webcam(FramesSource):
"""Webcam frame grabbing and preprocessing."""
def __init__(self, camera_id=0, fps=60, w=1280, h=720, **kwargs):
"""Create queues and threads to read and preprocess data."""
self._short_name = 'Webcam'
self._capture = cv.VideoCapture(camera_id)
self._capture.set(cv.CAP_PROP_FRAME_WIDTH, w)
self._capture.set(cv.CAP_PROP_FRAME_HEIGHT, h)
self._capture.set(cv.CAP_PROP_FOURCC, cv.VideoWriter_fourcc(*'MJPG'))
self._capture.set(cv.CAP_PROP_FPS, fps)
or use another face detection to replace dlib
from gazeml.
For me, reducing the resolution helped, just as @gy29289957 said.
Other option is to keep the same resolution, but decrease fps. Unfortunately, --fps
option doesn't work for me. I don't know if it falis in general, or it's just specific to my webcam. I ended up using this stupid hack:
def frame_generator(self):
"""Read frame from webcam."""
while True:
ret, bgr = self._capture.read()
ret, bgr = self._capture.read()
if ret:
yield bgr
Which isn't elegant but was enough for me. The duplicated self._capture.read()
causes frame_generator
to skip every other frame, which in practice gives 30fps.
from gazeml.
hello,
How can I fix the lag when running realtime on webcam, I implement it by GPU and cuda10 & Cudnn, but it has a periodic lag that I think its because of the program problem,
thanks to anyone can help me
from gazeml.
I also got exactly the same problem, when I test on video. However, I saved result afterward, I can check it later. Have you tried --from_video, too?
from gazeml.
I also got exactly the same problem, when I test on video. However, I saved result afterward, I can check it later. Have you tried --from_video, too?
No, actually my need is running realtime
from gazeml.
Have you try to adjust "--fps" ? or what kind of lag is it? Does it lag in certain pattern, like after every 60 frames will lag? Author did a batch result during inference. Maybe this is the reason. You can edit the code without batch output.
from gazeml.
Have you try to adjust "--fps" ? or what kind of lag is it? Does it lag in certain pattern, like after every 60 frames will lag? Author did a batch result during inference. Maybe this is the reason. You can edit the code without batch output.
I tried "--fps" but didn't work, yeah it lags in a certain pattern but I don't know how can I disable the batch output.
could u help me with that?!
from gazeml.
@meysam97
Currently, haven't got time to look into this.
If you have already solved, please share with us.
Thank you.
from gazeml.
from gazeml.
The lag still persists. The lag actually happens in multiples of 60 frames. Is this lag related to the batch inference?
from gazeml.
You can comment these lines of _record_frame()
function, it will solve the problem:
#now_time = time.time()
#if last_frame_time is not None:
# time_diff = now_time - last_frame_time
# while time_diff > 0.0:
# video_out.write(frame)
# time_diff -= out_frame_interval
#last_frame_time = now_time
from gazeml.
@hoangthang1607
Didn't help for me
from gazeml.
I am getting the same issue. Did anyone of you people find a solution to it? Commenting the lines mentioned by @hoangthang1607 didn't work for me.
from gazeml.
I managed to solve my problem as well. I built dlib from source with cuda enabled and managed to eliminate the bottleneck and got steady 23 fps. I then downloaded the tensorflow-gpu instead of the cpu version and managed to boost the speed up to steady 30 fps.
from gazeml.
I, too, have to problem with a powerful PC, Ubuntu 20.04, tf 1.14, CUDA 11.
It sometimes gets a weird lag peak even though mostly it's running with nice stable 30fps. Maybe the program is doing some heavy operations such as copying stuff to queue, moving them in memory or saving things on disk.
from gazeml.
Related Issues (20)
- Theta and Phi
- Train-data parameter in elg-demo file
- Video_out is not defined when using record_video for testing elg demo
- Running demo elg using CPU gives overlapping frame of original image and segmented eye image instead of segmented eye image in top-left corner
- Could you share code to test on different data sets?
- can_use_eye, can_use_eyelid and can_use_iris in elg_demo.py are False HOT 1
- Stuck with --from_video option HOT 3
- Could you please tell me where the pre-training weight should be placed in the Windows system?
- The project only has elg demo. how to run dpg demo
- RuntimeError: Error deserializing object of type int64 while deserializing a floating point number.
- Some questions about the 'unityeyes.py'
- iris_centre is not mean of iris_landmarks?
- About train/test data in MPIIGaze.h5
- Collaboration offer to help progress
- Gaze Vector Accuracy HOT 1
- elgo_demo.py stucks after video is closed HOT 1
- python and tensorflow version
- [TUTORIAL] How to save ELG model to .onnx and further to TensorRT .engine HOT 1
- Long proc time when running elg_demo.py on CPU HOT 1
- Can not get pre-trained weights
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gazeml.