Skip to content

Instantly share code, notes, and snippets.

View mrtj's full-sized avatar

Janos Tolgyesi mrtj

View GitHub Profile
{
"name": "code_node",
"interface": "${AWS_ACCOUNT_ID}::application_logic.interface",
"overridable": false,
"launch": "onAppStart"
}
panorama-cli build-container \
--container-asset-name code \
--package-path packages/${AWS_ACCOUNT_ID}-application_logic-1.0
{
"runtimeDescriptor": {
"envelopeVersion": "2021-01-01",
"entry": {
"path": "python3",
"name": "/panorama/application.py"
}
}
}
def main():
logger = get_logger(level=logging.DEBUG)
try:
logger.info('INITIALIZING APPLICATION')
app = Application(logger)
logger.info('PROCESSING STREAMS')
# video processing loop:
while True:
app.process_streams()
except:
import panoramasdk
import numpy as np
class Application(panoramasdk.node):
def __init__(self, logger):
super().__init__()
self.logger = logger
self.threshold = 0.
self.MODEL_NODE = 'model_node'
self.MODEL_INPUT_NAME = 'images'
import logging
from logging.handlers import RotatingFileHandler
def get_logger(name=__name__, level=logging.INFO):
logger = logging.getLogger(name)
logger.setLevel(level)
handler = RotatingFileHandler(
"/opt/aws/panorama/logs/app.log",
maxBytes=10000000,
backupCount=2
{
"name": "interface",
"category": "business_logic",
"asset": "",
"inputs": [
{
"name": "video_in",
"type": "media"
},
{
FROM public.ecr.aws/panorama/panorama-application
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir opencv-python numpy
COPY src /panorama
{
"mlModelDescriptor": {
"envelopeVersion": "2021-01-01",
"framework": "PYTORCH",
"inputs": [
{
"name": "images",
"shape": [1, 3, 640, 640]
}
]
{
"nodePackage": {
...
"interfaces": [
{
"name": "interface",
"category": "ml_model",
"asset": "yolox_s_asset",
...
}