Browse Source

update selected scene for SIN3D

Jérôme BUISINE 4 months ago
parent
commit
e322fe7a06
2 changed files with 86 additions and 15 deletions
  1. 18 15
      experimentConfig.default.js
  2. 68 0
      utils/extract_stats_freq_mean_std.py

+ 18 - 15
experimentConfig.default.js

@@ -54,41 +54,44 @@ export const experiments = {
     scenesConfig: {},
     availableScenes: {
       whitelist: [
-        'p3d_arcsphere-view0_part6',
         'p3d_bunny-fur-view0_part6',
+        'p3d_coffee-splash-view0_part6',
+        'p3d_ecosys-view0_part6',
+        'p3d_eponge-fractal-6-view0_part6',
+        'p3d_arcsphere-view0_part6',
         'p3d_car2-view0_part6',
         'p3d_caustic-view0_part6',
-        'p3d_chopper-titan-view0_part6',
-        'p3d_coffee-splash-view0_part6',
-        'p3d_cornel-box-view0_part6',
         'p3d_crown-view0_part6',
         'p3d_dragon-view0_part6',
         'p3d_dragon_250-view0_part6',
-        'p3d_ecosys-view0_part6',
-        'p3d_eponge-fractal-5-view0_part6',
-        'p3d_eponge-fractal-5-view1_part6',
-        'p3d_eponge-fractal-6-view0_part6',
         'p3d_eponge-fractal-6-view1_part6',
         'p3d_ganesha-view0_part6',
         'p3d_glass-of-water-view0_part6',
         'p3d_indirect-view0_part6',
-        'p3d_kitchen-view0_part6',
         'p3d_landscape-view3_part6',
-        'p3d_living-room-view0_part6',
-        'p3d_living-room-view1_part6',
-        'p3d_living-room-view2_part6',
-        'p3d_low_table_upper_view0_part6',
         'p3d_pavilion-day-view0_part6',
         'p3d_pavilion-day-view1_part6',
         'p3d_pavilion-day-view2_part6',
         'p3d_pavilion-night-view0_part6',
         'p3d_pavilion-night-view1_part6',
         'p3d_pavilion-night-view2_part6',
-        'p3d_sportscar-view0_part6',
         'p3d_staircase-view1_part6',
         'p3d_staircase2-view0_part6',
         'p3d_tt-view0_part6',
-        'p3d_vw-van-view0_part6'
+        'p3d_vw-van-view0_part6',
+        'p3d_low_table_2spheric_view0_part6',
+        'p3d_bathroom-view0_part6',
+        'p3d_classroom-view0_part6',
+        'p3d_classroom-view1_part6',
+        'p3d_contemporary-bathroom-view0_part6',
+        'p3d_contemporary-bathroom-view1_part6',
+        'p3d_glass-view0_part6',
+        'p3d_kitchen-view0_part6',
+        'p3d_kitchen-view1_part6',
+        'p3d_living-room-3-view0_part6',
+        'p3d_living-room-3-view1_part6',
+        'p3d_sanmiguel-view1_part6',
+        'p3d_sanmiguel-view2_part6'
       ],
       blacklist: null
       // No whitelist = Select all scenes

+ 68 - 0
utils/extract_stats_freq_mean_std.py

@@ -0,0 +1,68 @@
+# main imports
+import os, sys
+import argparse
+import json
+import numpy as np
+
+
+def main():
+    """
+    main function which is ran when launching script
+    """ 
+    parser = argparse.ArgumentParser(description="Extract scenes data and save thresholds into .csv")
+
+    parser.add_argument('--file', type=str, help='image to convert', required=True)
+    parser.add_argument('--output', type=str, help='output csv filename', required=True)
+    parser.add_argument('--freq', type=int, help='display user freq', choices=[0, 1], required=True)
+
+    args = parser.parse_args()
+
+    p_file   = args.file
+    p_output = args.output
+    p_freq = bool(args.freq)
+
+    f = open(p_file)
+    json_data = json.load(f)
+
+    dict_data = {}
+
+    for element in json_data:
+
+        scene = element['msg']['sceneName']
+
+        if scene not in dict_data:
+            dict_data[scene] = {}
+
+        extracts = element['msg']['extracts']
+
+        for extract in extracts:
+            if extract['index'] not in dict_data[scene]:
+                dict_data[scene][extract['index']] = [extract['quality']]
+            else:
+                dict_data[scene][extract['index']].append(extract['quality'])
+            
+    
+    output_file = open(p_output, 'w')
+    #output_file.write('scene;n_users;min_scene;\n')
+
+    for scene in dict_data:
+        output_file.write(scene)
+        
+        all_thresholds = []
+        n_users = 0
+        for extract in dict_data[scene]:
+            thresholds_data = dict_data[scene][extract]
+            
+            all_thresholds.append(int(np.mean(thresholds_data) + np.std(thresholds_data)))
+            n_users = len(thresholds_data)
+
+        if p_freq:
+            output_file.write(';' + str(n_users))
+        else:
+            for t in all_thresholds:
+                output_file.write(';' + str(t))
+
+        output_file.write(';\n')
+
+if __name__ == "__main__":
+    main()