Skip to content

Commit

Permalink
setup
Browse files Browse the repository at this point in the history
  • Loading branch information
prateekt committed Apr 17, 2023
1 parent 18975fb commit 983260d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
24 changes: 23 additions & 1 deletion battle_logger/pipeline.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import List
import os
from typing import List, Optional

from algo_ops.ops.op import Op
from algo_ops.pipeline.pipeline import Pipeline
Expand Down Expand Up @@ -31,6 +32,7 @@ def get_arch() -> List[Op]:
output_type=OutputType.TEXTBOX,
text_pipeline=None,
autosave_output_img_path=None,
store_intermediate_images=False,
),
BattleLoggerOp(),
]
Expand All @@ -53,5 +55,25 @@ def set_output_paths(
ffmpeg_op.image_out_path = image_out_path
ocr_pipeline_op.ocr_op.autosave_output_img_path = autosave_output_img_path

def save_output(self, out_path: str = ".", basename: Optional[str] = None) -> None:
"""
Saves pipeline Op outputs to file.
param out_path: Path to where output should go
param basename: Basename of output file
"""
os.makedirs(out_path, exist_ok=True)
for i, op_name in enumerate(self.ops.keys()):
op = self.ops[op_name]
assert isinstance(op, Op)
op_pipeline_name = self._pipeline_op_name(op=op)
if i == 0:
op.save_input(out_path=out_path, basename=op_pipeline_name)
# This is hack to get around dropping of input/output images in OCRPipeline
try:
op.save_output(out_path=out_path, basename=op_pipeline_name)
except ValueError:
pass

def __init__(self):
super().__init__(ops=self.get_arch())
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setuptools.setup(
name="pokemon-go-video-analysis",
version="0.0.0.0.5.2",
version="0.0.0.0.5.3",
author="Prateek Tandon",
author_email="[email protected]",
description="Pokemon Go Video Analysis",
Expand Down

0 comments on commit 983260d

Please sign in to comment.