Arpan Tripathi commited on
update organic upscaling scoring (#80)
Browse files
neurons/validator.py
CHANGED
|
@@ -30,6 +30,9 @@ VMAF_QUALITY_THRESHOLDS = [
|
|
| 30 |
95, #High
|
| 31 |
]
|
| 32 |
|
|
|
|
|
|
|
|
|
|
| 33 |
class Validator(base.BaseValidator):
|
| 34 |
def __init__(self):
|
| 35 |
super().__init__()
|
|
@@ -284,9 +287,9 @@ class Validator(base.BaseValidator):
|
|
| 284 |
|
| 285 |
batch_processed_time = time.time() - batch_start_time
|
| 286 |
|
| 287 |
-
sleep_time =
|
| 288 |
logger.info(f"Completed upscaling batch within {batch_processed_time:.2f} seconds")
|
| 289 |
-
logger.info(f"Sleeping for
|
| 290 |
|
| 291 |
await asyncio.sleep(sleep_time)
|
| 292 |
|
|
@@ -342,10 +345,10 @@ class Validator(base.BaseValidator):
|
|
| 342 |
asyncio.create_task(self.score_compressions(uids, responses, payload_urls, reference_video_paths, timestamp, video_ids, uploaded_object_names, vmaf_threshold, round_id))
|
| 343 |
|
| 344 |
batch_processed_time = time.time() - batch_start_time
|
| 345 |
-
sleep_time =
|
| 346 |
|
| 347 |
logger.info(f"Completed compression batch within {batch_processed_time:.2f} seconds")
|
| 348 |
-
logger.info(f"Sleeping for
|
| 349 |
|
| 350 |
await asyncio.sleep(sleep_time)
|
| 351 |
|
|
|
|
| 30 |
95, #High
|
| 31 |
]
|
| 32 |
|
| 33 |
+
SLEEP_TIME_LOW = 60 * 5 # 5 minutes
|
| 34 |
+
SLEEP_TIME_HIGH = 60 * 8 # 8 minutes
|
| 35 |
+
|
| 36 |
class Validator(base.BaseValidator):
|
| 37 |
def __init__(self):
|
| 38 |
super().__init__()
|
|
|
|
| 287 |
|
| 288 |
batch_processed_time = time.time() - batch_start_time
|
| 289 |
|
| 290 |
+
sleep_time = random.uniform(SLEEP_TIME_LOW, SLEEP_TIME_HIGH) - batch_processed_time
|
| 291 |
logger.info(f"Completed upscaling batch within {batch_processed_time:.2f} seconds")
|
| 292 |
+
logger.info(f"Sleeping for 5-8 minutes before next upscaling batch")
|
| 293 |
|
| 294 |
await asyncio.sleep(sleep_time)
|
| 295 |
|
|
|
|
| 345 |
asyncio.create_task(self.score_compressions(uids, responses, payload_urls, reference_video_paths, timestamp, video_ids, uploaded_object_names, vmaf_threshold, round_id))
|
| 346 |
|
| 347 |
batch_processed_time = time.time() - batch_start_time
|
| 348 |
+
sleep_time = random.uniform(SLEEP_TIME_LOW, SLEEP_TIME_HIGH) - batch_processed_time
|
| 349 |
|
| 350 |
logger.info(f"Completed compression batch within {batch_processed_time:.2f} seconds")
|
| 351 |
+
logger.info(f"Sleeping for 5-8 minutes before next compression batch")
|
| 352 |
|
| 353 |
await asyncio.sleep(sleep_time)
|
| 354 |
|
services/scoring/server.py
CHANGED
|
@@ -1735,13 +1735,16 @@ async def score_organics_upscaling(request: OrganicsUpscalingScoringRequest) ->
|
|
| 1735 |
# Final scoring based on ClipIQ scores
|
| 1736 |
if dist_clipiqa_score > ref_clipiqa_score:
|
| 1737 |
final_score = 3
|
| 1738 |
-
reason = "
|
| 1739 |
-
elif dist_clipiqa_score >
|
| 1740 |
final_score = 2
|
| 1741 |
-
reason = "
|
| 1742 |
-
|
| 1743 |
final_score = 1
|
| 1744 |
-
reason = "
|
|
|
|
|
|
|
|
|
|
| 1745 |
|
| 1746 |
logger.info(f"Final score: {final_score} ({reason})")
|
| 1747 |
|
|
|
|
| 1735 |
# Final scoring based on ClipIQ scores
|
| 1736 |
if dist_clipiqa_score > ref_clipiqa_score:
|
| 1737 |
final_score = 3
|
| 1738 |
+
reason = "upscaled better than reference"
|
| 1739 |
+
elif dist_clipiqa_score > (ref_upscaled_clipiqa_score * 1.05):
|
| 1740 |
final_score = 2
|
| 1741 |
+
reason = "upscaled at least 5% better than ffmpeg upscaled"
|
| 1742 |
+
elif dist_clipiqa_score > (ref_upscaled_clipiqa_score):
|
| 1743 |
final_score = 1
|
| 1744 |
+
reason = "Better than ffmpeg upscaled"
|
| 1745 |
+
else:
|
| 1746 |
+
final_score = 0
|
| 1747 |
+
reason = "Worse than ffmpeg upscaled"
|
| 1748 |
|
| 1749 |
logger.info(f"Final score: {final_score} ({reason})")
|
| 1750 |
|
vidaio_subnet_core/validating/managing/miner_manager.py
CHANGED
|
@@ -878,6 +878,7 @@ class MinerManager:
|
|
| 878 |
# Convert organic scores to synthetic-like format
|
| 879 |
|
| 880 |
acc_score = 0.0
|
|
|
|
| 881 |
|
| 882 |
if score == 3.0:
|
| 883 |
organic_s_f = 0.4
|
|
@@ -885,7 +886,6 @@ class MinerManager:
|
|
| 885 |
organic_s_l = 0.5
|
| 886 |
success = True
|
| 887 |
|
| 888 |
-
current_score = miner.accumulate_score
|
| 889 |
boost_percentage = 0.03
|
| 890 |
boost_amount = current_score * boost_percentage
|
| 891 |
acc_score = current_score + boost_amount
|
|
@@ -904,7 +904,6 @@ class MinerManager:
|
|
| 904 |
organic_s_l = 0.5 # Moderate length score
|
| 905 |
success = False
|
| 906 |
|
| 907 |
-
current_score = miner.accumulate_score
|
| 908 |
panelty_percentage = 0.05
|
| 909 |
panelty_amount = current_score * panelty_percentage
|
| 910 |
acc_score = current_score - panelty_amount
|
|
@@ -915,7 +914,6 @@ class MinerManager:
|
|
| 915 |
organic_s_l = 0.0
|
| 916 |
success = False
|
| 917 |
|
| 918 |
-
current_score = miner.accumulate_score
|
| 919 |
panelty_percentage = 0.15 # Deduct 15% of current score
|
| 920 |
panelty_amount = current_score * panelty_percentage
|
| 921 |
acc_score = current_score - panelty_amount
|
|
@@ -1038,8 +1036,8 @@ class MinerManager:
|
|
| 1038 |
|
| 1039 |
# Accumulate score with decay factor (same as synthetic)
|
| 1040 |
miner.accumulate_score = (
|
| 1041 |
-
miner.accumulate_score *
|
| 1042 |
-
+ score_with_multiplier * (1 -
|
| 1043 |
)
|
| 1044 |
miner.accumulate_score = max(0, miner.accumulate_score)
|
| 1045 |
|
|
|
|
| 878 |
# Convert organic scores to synthetic-like format
|
| 879 |
|
| 880 |
acc_score = 0.0
|
| 881 |
+
current_score = miner.accumulate_score
|
| 882 |
|
| 883 |
if score == 3.0:
|
| 884 |
organic_s_f = 0.4
|
|
|
|
| 886 |
organic_s_l = 0.5
|
| 887 |
success = True
|
| 888 |
|
|
|
|
| 889 |
boost_percentage = 0.03
|
| 890 |
boost_amount = current_score * boost_percentage
|
| 891 |
acc_score = current_score + boost_amount
|
|
|
|
| 904 |
organic_s_l = 0.5 # Moderate length score
|
| 905 |
success = False
|
| 906 |
|
|
|
|
| 907 |
panelty_percentage = 0.05
|
| 908 |
panelty_amount = current_score * panelty_percentage
|
| 909 |
acc_score = current_score - panelty_amount
|
|
|
|
| 914 |
organic_s_l = 0.0
|
| 915 |
success = False
|
| 916 |
|
|
|
|
| 917 |
panelty_percentage = 0.15 # Deduct 15% of current score
|
| 918 |
panelty_amount = current_score * panelty_percentage
|
| 919 |
acc_score = current_score - panelty_amount
|
|
|
|
| 1036 |
|
| 1037 |
# Accumulate score with decay factor (same as synthetic)
|
| 1038 |
miner.accumulate_score = (
|
| 1039 |
+
miner.accumulate_score * CONFIG.score.decay_factor
|
| 1040 |
+
+ score_with_multiplier * (1 - CONFIG.score.decay_factor)
|
| 1041 |
)
|
| 1042 |
miner.accumulate_score = max(0, miner.accumulate_score)
|
| 1043 |
|