HardikUppal commited on
Commit
3708026
·
1 Parent(s): 953a2bf

adjusted chroma settings

Browse files
flagged/Processed Image/028ae1a27b4f747f5e2e/image.webp ADDED
flagged/Upload an Image/5517bdf8e63e3c9acf0f/Image from iOS.jpg ADDED
flagged/log.csv ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ Upload an Image,L% Min Skin,L% Max Skin,L% Min Tonality,L% Max Tonality,Chroma Threshold,Skin Analysis,Eye Analysis,Hair Analysis,Processed Image,Analysis Results,flag,username,timestamp
2
+ flagged/Upload an Image/5517bdf8e63e3c9acf0f/Image from iOS.jpg,10,90,37,67,116,true,false,false,flagged/Processed Image/028ae1a27b4f747f5e2e/image.webp,"{""skin_analysis"": {""undertone"": ""Warm"", ""overtone"": ""Dark"", ""tonality"": ""Deep"", ""season"": ""Light Spring"", ""chroma"": ""Muted"", ""chroma_counts"": {""Bright"": 0, ""Muted"": 756205}, ""undertone_counts"": {""Warm"": 632189, ""Cool"": 124016, ""Neutral"": 0}, ""overtone_counts"": {""Very Light"": 60556, ""Light"": 73612, ""Medium"": 213157, ""Olive"": 173875, ""Dark"": 235005}, ""tonality_counts"": {""Light"": 249359, ""True"": 226941, ""Deep"": 279905}, ""season_counts"": {""Light Spring"": 0, ""True Spring"": 0, ""Warm Spring"": 0, ""Light Autumn"": 0, ""True Autumn"": 0, ""Warm Autumn"": 0, ""Light Summer"": 0, ""True Summer"": 0, ""Cool Summer"": 0, ""Light Winter"": 0, ""True Winter"": 0, ""Cool Winter"": 0, ""Unknown"": 0}}}",,,2024-06-19 11:53:23.491279
src/skin_analyzer.py CHANGED
@@ -299,16 +299,20 @@ def categorize_chroma(lab_pixels, chroma_thresh):
299
  :return: Chroma category (Bright, Muted).
300
  """
301
  chroma = []
 
302
  for pixel in lab_pixels:
303
  a = pixel[1]
304
  b = pixel[2]
305
  distance = np.sqrt(a**2 + b**2)
306
  if distance > chroma_thresh:
307
  chroma.append("Bright")
 
308
  else:
309
  chroma.append("Muted")
 
310
 
311
- return chroma
 
312
 
313
 
314
  def categorize_undertones(cluster_centers):
@@ -388,7 +392,9 @@ def analyze_skin_function(
388
  )
389
 
390
  # calculate chroma
391
- chroma = categorize_chroma(lab_pixels, chroma_thresh)
 
 
392
 
393
  season_counts, predominant_season, seasons = determine_season_with_tonality(
394
  undertones, chroma, tonalities
@@ -442,8 +448,10 @@ def analyze_skin_function(
442
  "tonality": predominant_tonality,
443
  # "ita": np.mean(ITA_values),
444
  "season": predominant_season,
 
445
  # "overlay_image": overlay,
446
  "filtered_skin_mask": filtered_skin_mask,
 
447
  "undertone_counts": undertone_counts,
448
  "overtone_counts": overtone_counts,
449
  "tonality_counts": tonality_counts,
 
299
  :return: Chroma category (Bright, Muted).
300
  """
301
  chroma = []
302
+ chroma_counts = {"Bright": 0, "Muted": 0}
303
  for pixel in lab_pixels:
304
  a = pixel[1]
305
  b = pixel[2]
306
  distance = np.sqrt(a**2 + b**2)
307
  if distance > chroma_thresh:
308
  chroma.append("Bright")
309
+ chroma_counts["Bright"] += 1
310
  else:
311
  chroma.append("Muted")
312
+ chroma_counts["Muted"] += 1
313
 
314
+ predominant_chroma = max(chroma_counts, key=chroma_counts.get)
315
+ return chroma_counts, predominant_chroma, chroma
316
 
317
 
318
  def categorize_undertones(cluster_centers):
 
392
  )
393
 
394
  # calculate chroma
395
+ chroma_counts, predominant_chroma, chroma = categorize_chroma(
396
+ lab_pixels, chroma_thresh
397
+ )
398
 
399
  season_counts, predominant_season, seasons = determine_season_with_tonality(
400
  undertones, chroma, tonalities
 
448
  "tonality": predominant_tonality,
449
  # "ita": np.mean(ITA_values),
450
  "season": predominant_season,
451
+ "chroma": predominant_chroma,
452
  # "overlay_image": overlay,
453
  "filtered_skin_mask": filtered_skin_mask,
454
+ "chroma_counts": chroma_counts,
455
  "undertone_counts": undertone_counts,
456
  "overtone_counts": overtone_counts,
457
  "tonality_counts": tonality_counts,