Skip to content

Commit

Permalink
Merge pull request #340 from skier233/main
Browse files Browse the repository at this point in the history
AI Tagger code refactoring bug fix
  • Loading branch information
Maista6969 authored Jun 14, 2024
2 parents 0caa188 + a5fc841 commit c2cbbe9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 2 additions & 0 deletions plugins/AITagger/ai_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import config
import stashapi.log as log

current_videopipeline = None

# ----------------- AI Server Calling Functions -----------------

async def post_api_async(session, endpoint, payload):
Expand Down
3 changes: 1 addition & 2 deletions plugins/AITagger/ai_tagger.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ def install(package):
semaphore = asyncio.Semaphore(config.CONCURRENT_TASK_LIMIT)
progress = 0
increment = 0.0
current_videopipeline = None

# ----------------- Main Execution -----------------

Expand Down Expand Up @@ -177,7 +176,7 @@ async def __tag_scene(scene):
async with semaphore:
scenePath = scene['files'][0]['path']
sceneId = scene['id']
log.info("files result:" + str(scene['files'][0]))
log.debug("files result:" + str(scene['files'][0]))
phash = scene['files'][0].get('fingerprint', None)
duration = scene['files'][0].get('duration', None)
if duration is None:
Expand Down
4 changes: 2 additions & 2 deletions plugins/AITagger/ai_video_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def already_contains_model(self, model_config):
toReturn = (correspondingModelInfo is not None and correspondingModelInfo.version == model_config.pipeline_version and
correspondingModelInfo.ai_model_config.frame_interval == model_config.frame_interval and
correspondingModelInfo.ai_model_config.threshold == model_config.threshold)
log.info(f"Already contains model: {toReturn}, {correspondingModelInfo is not None}, {correspondingModelInfo.version == model_config.pipeline_version}, {correspondingModelInfo.ai_model_config.frame_interval == model_config.frame_interval}, {correspondingModelInfo.ai_model_config.threshold == model_config.threshold}")
log.debug(f"Already contains model: {toReturn}, {correspondingModelInfo is not None}, {correspondingModelInfo.version == model_config.pipeline_version}, {correspondingModelInfo.ai_model_config.frame_interval == model_config.frame_interval}, {correspondingModelInfo.ai_model_config.threshold == model_config.threshold}")
return toReturn

def __str__(self):
Expand Down Expand Up @@ -180,7 +180,7 @@ def from_csv_file(cls, csv_file, scene_id, phash, duration):
for row in reader:
frame_index = float(row[0])
if last_frame_index is not None and frame_interval is None:
log.info(f"Calculating frame interval: {frame_index} - {last_frame_index}")
log.debug(f"Calculating frame interval: {frame_index} - {last_frame_index}")
frame_interval = frame_index - last_frame_index
for tag_name in row[1:]: # Skip the first column (frame_indexes)
if tag_name: # If the cell is not empty
Expand Down
2 changes: 1 addition & 1 deletion plugins/AITagger/config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CREATE_MARKERS = True
FRAME_INTERVAL = 0.5
FRAME_INTERVAL = 2
IMAGE_THRESHOLD = 0.5

API_BASE_URL = 'http://localhost:8000'
Expand Down

0 comments on commit c2cbbe9

Please sign in to comment.