config.py 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. # main imports
  2. import os
  3. # env variables
  4. WEB_API_PREFIX_URL_KEY = 'WEB_API_PREFIX_URL'
  5. WEB_API_PREFIX_URL = os.environ.get(WEB_API_PREFIX_URL_KEY) \
  6. if os.environ.get(WEB_API_PREFIX_URL_KEY) is not None else 'api'
  7. # api variables
  8. DIRAN_DOMAIN_NAME = "https://diran.univ-littoral.fr/"
  9. GET_SCENE_QUALITIES_API_URL = DIRAN_DOMAIN_NAME + WEB_API_PREFIX_URL + "/listSceneQualities?sceneName={0}"
  10. GET_SCENE_IMAGE_API_URL = DIRAN_DOMAIN_NAME + WEB_API_PREFIX_URL + "/getImage?sceneName={0}&imageQuality={1}"
  11. GET_SCENES_API_URL = DIRAN_DOMAIN_NAME + WEB_API_PREFIX_URL + "/listScenes"
  12. # folder variables
  13. # TODO : dispatch into day and experiment ID
  14. model_expe_folder = "expes_models/{0}/{1}"
  15. output_expe_folder = "expes_results"
  16. output_expe_folder_date = "expes_results/date"
  17. output_expe_folder_id = "expes_results/expeId"
  18. output_expe_folder_name_id_day = "expes_results/expeId/{0}/{1}/{2}/{3}"
  19. output_expe_folder_name_day = "expes_results/date/{0}/{1}/{2}"
  20. output_tmp_folder = "tmp"
  21. # expes list
  22. expe_name_list = ["quest_one_image"]
  23. # configure experiments labels
  24. expes_configuration = {
  25. # First experiments configuration
  26. 'quest_one_image':{
  27. 'scenes':['contemporary', 'bathroom'],
  28. 'text':{
  29. 'question': "Do you see one image or a composition of more than one?",
  30. 'indication': "press RIGHT if you see 2 images, LEFT if not",
  31. 'end_text': "Experience is finished. Thanks for your participation",
  32. 'examples': {
  33. 'sentence': ["1st example : ",
  34. "The answer is 2 images! \n This image is cropped {0}.\n {1}% on the left originating from a low-quality image and on the right originating from high quality. \n So, press RIGHT.",
  35. "2nd example : ",
  36. "The answer is 1 image! \n This image is cropped {0} but \n {1}% on the left originating from a high-quality image and on the right originating from high quality, too.\n So, press LEFT.",
  37. "3rd example: ",
  38. "The answer is 2 images! \n This image is cropped {0}. \n {1}% on the upper part originating from a low-quality image and on the bottom originating from high quality. \n So, press RIGHT.",
  39. "4th example: ",
  40. "The answer is 2 images! \n This image is cropped {0}. \n {1}% on the upper part originating from a low-quality image and on the bottom originating from high quality. \n So, press RIGHT.",
  41. "5th example: ",
  42. "The answer is 1 image! \n This image is cropped {0}. \n {1}% on the upper part originating from a high-quality image and on the bottom originating from a low-quality quality.\n So, press RIGHT.",
  43. "6th example: ",
  44. "The answer is 2 images! \n This image is cropped {0}. \n {1}% on the left originating from a low-quality image and on the right originating from high quality. \n So, press RIGHT.",
  45. ],
  46. 'crop_params': [
  47. [0.3, 0, 0],
  48. [0.3, 0, 0],
  49. [0.3, 0, 0],
  50. [0.3, 0, 0],
  51. [0.7, 1, 0],
  52. [0.7, 1, 0],
  53. [0.2, 1, 0],
  54. [0.2, 1, 0],
  55. [0.8, 1, 1],
  56. [0.8, 1, 1],
  57. [0.2, 0, 0],
  58. [0.2, 0, 0]
  59. ],
  60. 'images': [
  61. [1, -1],
  62. [1, -1],
  63. [-1, -1],
  64. [-1, -1],
  65. [7, -1],
  66. [7, -1],
  67. [15, -1],
  68. [15, -1],
  69. [20, -1],
  70. [20, -1],
  71. [30, -1],
  72. [30, -1]
  73. ]
  74. }
  75. },
  76. 'params':{
  77. 'iterations': 100,
  78. 'entropy': 5,
  79. 'slopes':{
  80. 'contemporary' : [0.0001, 0.001, 0.00003], #start, stop, step
  81. 'bathroom' : [0.0005, 0.01, 0.0003], #start, stop, step
  82. },
  83. },
  84. # if others custom session param are directly set for experiments
  85. 'session_params': [
  86. 'expe_data',
  87. ],
  88. # template file used in django `expe` route
  89. 'template': 'expe/expe.html',
  90. # javascript file used
  91. 'javascript':[
  92. 'loadImg.js',
  93. 'keyEvents.js'
  94. ],
  95. 'output_header':
  96. "stimulus;name_stimulus;cropping_percentage;orientation;image_ref_position;answer;time_reaction;entropy\n"
  97. }
  98. }