This commit is contained in:
2025-07-18 17:15:50 -04:00
parent 3dea3786e8
commit 571500b291
6 changed files with 72 additions and 20 deletions

View File

@@ -33,9 +33,31 @@ class RESULT_TYPE():
NO_JSON = 4
def get_ok_to_delete(file_path):
max_look = 5
c_path = file_path
settings_default = {'class_threshold':10000, 'frames_with_dets_threshold': -10000}
for i in range(max_look):
c_path = os.path.abspath(os.path.join(c_path, '..'))
test_path = os.path.join(c_path, 'settings.json')
if os.path.exists(test_path):
with open(test_path, 'r') as rr:
settings = json.load(rr)
settings_default.update(settings)
return settings_default
def exec_file_remove_logic(file_path):
result = RESULT_TYPE.NOTHING
cset = get_cset_for_file_matching(file_path)
settings = get_ok_to_delete(cset['.mp4'])
logger.info(f"EVALUATING LOGIC WITH SETTINGS: "+str(settings))
if settings['class_threshold'] > 1:
logger.info(f"THRESHOLD SET TO ABOVE 1, SKIPPING: {file_path}")
result = RESULT_TYPE.HAS_OBJS
return
logger.info(f"EXECUTING_LOGIC :{file_path}")
json_check = '.json.orin'
if '.has_objs' in cset:
@@ -52,8 +74,8 @@ def exec_file_remove_logic(file_path):
with open(cset[json_check],'r') as jj:
det_data = json.load(jj)
thresh = 0.2
frames_with_dets_thresh = 0.1
thresh = settings['class_threshold']
frames_with_dets_thresh = settings['frames_with_dets_threshold']
all_scores = list()
for x in det_data['scores']: