roboflow / video-inference Goto Github PK
View Code? Open in Web Editor NEWExample showing how to do inference on a video file with Roboflow Infer
Home Page: https://blog.roboflow.com/video-inference/
License: MIT License
Example showing how to do inference on a video file with Roboflow Infer
Home Page: https://blog.roboflow.com/video-inference/
License: MIT License
This repo was programmed prior to the change over to detect.roboflow from infer.roboflow and the new URL scheme and api_key parameter name. The inference URL needs to be updated according to the new documentation: https://docs.roboflow.com/inference/hosted-api
Full error
[mjpeg @ 0x7f9713809400] No JPEG data found in image
Error while decoding stream #0:0: Invalid data found when processing input
Cannot determine format of input stream 0:0 after EOF
Error marking filters as finished
If you get this error, you probably tried to infer against a model URL that doesn't exist.
We should surface this and not let the script try to compile the inference video without output frames
ROBOFLOW_KEY=xxxxx ./infer.sh [YOUR_DATASET]/[YOUR_VERSION] video_in.mp4 video_out.mov 이 코드를 vscode에서 실행 중인데요, ./infer.sh 이 부분 ./에서 계속 오류가 납니다. 작업파일과 같은 경로에 있는데도 말이지요. 왜 그럴까요?
Hello, I'm trying to get this running on my segmentation model. I'm making progress, but have now run out of free credits so can't debug any further!
On first attempt to run the script, I got the error No JPEG data found in image
(similar to #2).
Checking the docs, I see segmentation models run on a different url: https://detect.roboflow.com
Correcting that, I also noticed that the url returns json data containing b64 encoded image data, so I used jq
and base64
to get it into a file.
Finally I noticed the received image data is in png format, so I changed the file suffix to match, to make ffmpeg
happy.
At that point the script completes without error and produces a video, however the video is entirely black. I'm not sure if that is due to a remaining bug, or if it is because I am out of credits.
Here's my full diff right now, could probably be cleaned up a bit:
diff --git a/infer.sh b/infer.sh
index 3dbe286..9d54493 100755
--- a/infer.sh
+++ b/infer.sh
@@ -56,7 +56,7 @@ _arg_model=
_arg_video_in=
_arg_video_out=
# THE DEFAULTS INITIALIZATION - OPTIONALS
-_arg_host="https://detect.roboflow.com"
+_arg_host="https://segment.roboflow.com"
_arg_confidence="50"
_arg_overlap="50"
_arg_stroke="5"
@@ -343,7 +343,7 @@ done
exit 1;
}
-inference_url="$host/$model?api_key=$ROBOFLOW_KEY&format=image&confidence=$confidence&overlap=$overlap&stroke=$stroke"
+inference_url="$host/$model?api_key=$ROBOFLOW_KEY"
if [ $labels = "on" ]; then
inference_url="$inference_url&labels=on"
fi
@@ -393,14 +393,14 @@ do
if [ ! -z "$verbose" ]; then
echo "Running inference on frame $f..."
fi
- cat $tmp/roboflow_in/$f | base64 | curl -s -d @- $inference_url > "$tmp/roboflow_out/$f" &
+ cat $tmp/roboflow_in/$f | base64 | curl -s -d @- $inference_url | jq -r .segmentation_mask | base64 --decode > "$tmp/roboflow_out/$f.png"
fi
done
done
rm -f $out
echo "Rendering final video ($out)."
-ffmpeg -i $tmp/roboflow_out/frame%05d.jpg -vf fps=$fps_out $out
+ffmpeg -i $tmp/roboflow_out/frame%05d.jpg.png -vf fps=$fps_out $out
rm -rf $tmp/roboflow_in
rm -rf $tmp/roboflow_out
Any chance you could reimburse me some credits in exchange for this bug report? I wanted to work on my project, but ended up spending all my time and credits debugging this script! My roboflow account is associated with this github account.
If the intention is not to support segmentation models with this script, at least it would be nice if that was indicated clearly in the README, such that others do not lose time and credits as I did.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.