Skip to content

Instantly share code, notes, and snippets.

Avatar

Janos Tolgyesi mrtj

View GitHub Profile
View panorama-build-container.sh
panorama-cli build-container \
--container-asset-name code \
--package-path packages/${AWS_ACCOUNT_ID}-application_logic-1.0
View panorama-application-descriptor.json
{
"runtimeDescriptor": {
"envelopeVersion": "2021-01-01",
"entry": {
"path": "python3",
"name": "/panorama/application.py"
}
}
}
View panorama-application-main.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:
View panorama-application-stub.py
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'
View panorama-logger.py
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
View panorama-application-node-interface.json
{
"name": "interface",
"category": "business_logic",
"asset": "",
"inputs": [
{
"name": "video_in",
"type": "media"
},
{
View panorama-application.Dockerfile
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
View panorama-model-descriptor.json
{
"mlModelDescriptor": {
"envelopeVersion": "2021-01-01",
"framework": "PYTORCH",
"inputs": [
{
"name": "images",
"shape": [1, 3, 640, 640]
}
]
View panorama-model-interface.json
{
"nodePackage": {
...
"interfaces": [
{
"name": "interface",
"category": "ml_model",
"asset": "yolox_s_asset",
...
}
View panorama-merged-model-node.json
{
"name": "model_node",
"interface": "<AWS_ACCOUNT_ID>::yolox_s.interface",
"overridable": false,
"launch": "onAppStart"
}