This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "code_node", | |
"interface": "${AWS_ACCOUNT_ID}::application_logic.interface", | |
"overridable": false, | |
"launch": "onAppStart" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
panorama-cli build-container \ | |
--container-asset-name code \ | |
--package-path packages/${AWS_ACCOUNT_ID}-application_logic-1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"runtimeDescriptor": { | |
"envelopeVersion": "2021-01-01", | |
"entry": { | |
"path": "python3", | |
"name": "/panorama/application.py" | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "interface", | |
"category": "business_logic", | |
"asset": "", | |
"inputs": [ | |
{ | |
"name": "video_in", | |
"type": "media" | |
}, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"mlModelDescriptor": { | |
"envelopeVersion": "2021-01-01", | |
"framework": "PYTORCH", | |
"inputs": [ | |
{ | |
"name": "images", | |
"shape": [1, 3, 640, 640] | |
} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"nodePackage": { | |
... | |
"interfaces": [ | |
{ | |
"name": "interface", | |
"category": "ml_model", | |
"asset": "yolox_s_asset", | |
... | |
} |