Comments (6)
Most likely there is an exception being thrown in your gvapython code either on initialization or when saving data.
Before starting VA Serving, you can increase the GST_DEBUG level to 3 (you can do this via environment variable) which in most cases will give you more information on the error in the python script.
If possible - if you can share the:
- pipeline
- gvapython script
We might be able to see more easily what might be the issue - but I suspect a python exception.
I've added here a simple example of the gvapython code for dumping the caps from a pipeline to a file.
'''
* Copyright (C) 2019-2020 Intel Corporation.
*
* SPDX-License-Identifier: BSD-3-Clause
'''
import os
import json
class FrameInfo:
def __init__(self):
self._output_path = "/tmp"
self._initialized = False
self._source = "example"
def write_caps(self, frame):
path = "{}/caps.json".format(self._output_path)
try:
os.makedirs(self._output_path,exist_ok=True)
os.remove(path)
except Exception as e:
pass
with open(path,"w") as file:
value = {'caps':str(frame.video_info().to_caps()),
'source':self._source}
file.write(json.dumps(value))
file.flush()
@staticmethod
def read_caps(input_path):
path = "{}/caps.json".format(input_path)
caps = None
with open(path,"r") as file:
caps = json.load(file)
return caps
def process_frame(self,frame):
if (not self._initialized):
self.write_caps(frame)
self._initialized = True
return True
from pipeline-server.
Sorry that was my fault, storing is working well
but I can`t send kwarg argument to gvapython (by starting the script via sh all works well)
i tried something like this:
{
"name": "main_settings",
"version": 2,
"type": "GStreamer",
"template": [
"urisourcebin buffer-size=4096 name=source ! decodebin ! videoconvert ! video/x-raw,format=BGR ! queue ! ",
"gvadetect model-instance-id=inf0 model={models[person-detection-retail-0013][1][network]} model-proc={models[person-detection-retail-0013][1][proc]} name=detection ! queue ! ",
"gvapython module=\"/home/openvino/gst/main/py_modules/test_area.py\" class=FrameInfo name=main ! ",
"appsink name=appsink"
],
"description": "persons detection w.o. face recognition",
"parameters": {
"type": "object",
"properties": {
"kwarg": {
"element": "main",
"type": "string",
"default": "{\"config\":\"/home/openvino/gst/main/model_proc/filter_detections.json\",\"cam_name\":\"CAM_00\"}"
}
}
}
}
from pipeline-server.
Please add a "format":"json" property to the parameter. You can see the example above from smart city. Apologies as we haven't documented this requirement yet.
"element": {
"name": "crowdcounting",
"property": "kwarg",
"format": "json"
},
from pipeline-server.
I tried, but the script doesn't got kwarg...
{
"name": "main_settings",
"version": 2,
"type": "GStreamer",
"template": [
"urisourcebin buffer-size=4096 name=source ! decodebin ! videoconvert ! video/x-raw,format=BGR ! queue ! ",
"gvadetect model-instance-id=inf0 model={models[person-detection-retail-0013][1][network]} model-proc={models[person-detection-retail-0013][1][proc]} name=detection ! queue ! ",
"gvapython module="/home/openvino/gst/main/py_modules/test_area.py" class=FrameInfo name=main ! ",
"appsink name=appsink"
],
"description": "persons detection w.o. face recognition",
"parameters": {
"type": "object",
"properties": {
"main": {
"element": {
"name": "main",
"property": "kwarg",
"format": "json"
},
"type": "object",
"properties": {
"width": {
"type": "integer",
"default": 100
},
"height": {
"type": "integer",
"default": 200
},
"zonemap": {
"type": "array",
"items": {
"type": "object"
}
}
}
}
}
}
}
py:
`import os
import json
import cv2
from datetime import datetime
class FrameInfo:
def __init__(self, height=1, width=1, zonemap=[]):
self._output_path = "/home/openvino/area"
self._initialized = False
self._source = "example"
self.k = {'h': height, 'w': width}
def write_caps(self, frame):
path = "{}/caps2.json".format(self._output_path)
try:
os.makedirs(self._output_path, exist_ok=True)
os.remove(path)
except Exception as e:
pass
with open(path, "w") as file:
file.write(json.dumps(self.k))
file.flush()
with frame.data() as mat:
cv2.imwrite(os.path.join(self._output_path, 'im.jpg'), img=mat)
@staticmethod
def read_caps(input_path):
path = "{}/caps2.json".format(input_path)
caps = None
with open(path, "r") as file:
caps = json.load(file)
return caps
def process_frame(self, frame):
if (not self._initialized):
self.write_caps(frame)
self._initialized = True
return True`
but in json I get:
{"h": 1, "w": 1}
PS Image is stored well
Thank U
from pipeline-server.
The default value for the object needs to be specified at the parameter level and not in the individual properties (due to a quirk in how default values are applied).
Pipeline Definition:
{
"type": "GStreamer",
"template": ["videotestsrc ! gvapython name=main module=temp.py class=Test ! fakesink"],
"description": "Test Pipeline",
"parameters": {
"type": "object",
"properties": {
"main":{
"element": {
"name":"main",
"format":"json",
"property":"kwarg"
},
"type":"object",
"properties": {
"height": {
"type":"integer",
"minimum":1,
"maximum":200
},
"width": {
"type":"integer",
"minimum":1,
"maximum":100
}
},
"default": {
"height":100,
"width":100
}
}
}
}
}
gvapython code
class Test:
def __init__(self,height,width):
print(height,width)
def process_frame(self,frame):
pass
Simple va serving code example:
'''
* Copyright (C) 2019 Intel Corporation.
*
* SPDX-License-Identifier: BSD-3-Clause
'''
import os
import json
from vaserving.vaserving import VAServing
request = {
"source": {
"uri": "file:///example",
"type": "uri"
},
"destination": {
"type":"file",
"path":"/dev/stdout"
}
}
if __name__=="__main__":
VAServing.start({'log_level': 'DEBUG',
"ignore_init_errors":True})
pipeline = VAServing.pipeline("test", 1)
parameters = {}
# uncomment to change default
# parameters = {"main":{"height":50,"width":6}}
pipeline.start(request,
parameters=parameters)
VAServing.stop()
from pipeline-server.
Thank U
It s great
please put it into your documentation (how to make a json)! all python-zombi will be glad about josinifying of args and kwargs
from pipeline-server.
Related Issues (20)
- Kubernetes deployment fails if no_proxy contains * HOT 1
- When interrupting run of multiple streams vaclient prints fps of last stream not average HOT 1
- v0.7.1 client incompatible with earlier versions of the service HOT 1
- GPU inference fails on 12th Gen Intel® Core™ systems HOT 1
- Pipeline server client requests blocked by iboss HOT 9
- Server crashes after several minutes when using RTSP camera and GPU inference on 11th Gen Intel® Core™ and later HOT 1
- Memory leak on pipeline stop HOT 1
- Pipeline error when using some RTSP cameras HOT 4
- Kubernetes support for RTSP, WebRTC and HLS HOT 2
- Yolo-v3-tiny-tf model with INT-8 precision gives bad inferences HOT 8
- Parameter substitution in pipeline template crashes the server HOT 3
- pipeline shows error with splitmuxsink HOT 4
- How to add jpegenc (to generate snapshot) and splitmuxsink (to generate video) together in a single pipeline? HOT 3
- What is the meaning of pipeline status QUEUED and COMPLETE. why some pipeline keep stick at queued state? HOT 2
- No error on multiple pipeline json files for same name and version
- docker build command fails HOT 2
- Segfault in libgstvaapi.so HOT 5
- pipeline stuck with Error: Nonetype HOT 3
- Pipeline server fails to start - /lib/python3.8/runpy.py missing HOT 2
- Unable to build pipeline_server docker container
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 pipeline-server.