dwb2023 commited on
Commit
56bb16d
1 Parent(s): f2cdd66

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -8,7 +8,7 @@ dataset = load_dataset("dwb2023/brain-tumor-image-dataset-semantic-segmentation"
8
  # print(f"Dataset loaded successfully. Number of images: {len(dataset)}")
9
 
10
  CATEGORY_COLORS = {
11
- 1: "red",
12
  2: "green"
13
  }
14
 
@@ -30,13 +30,13 @@ def draw_annotations(index):
30
  # Draw bounding box with color based on category
31
  bbox = record["bbox"]
32
  category_id = record["category_id"]
33
- box_color = CATEGORY_COLORS.get(category_id, "blue") # Default to blue if category not in mapping
34
  draw.rectangle([bbox[0], bbox[1], bbox[0] + bbox[2], bbox[1] + bbox[3]], outline=box_color, width=2)
35
 
36
  # Draw segmentation mask
37
  segmentation = record["segmentation"]
38
  for seg in segmentation:
39
- draw.polygon(seg, outline="blue", width=2)
40
 
41
  # Prepare additional information
42
  area = record["area"]
 
8
  # print(f"Dataset loaded successfully. Number of images: {len(dataset)}")
9
 
10
  CATEGORY_COLORS = {
11
+ 1: "blue",
12
  2: "green"
13
  }
14
 
 
30
  # Draw bounding box with color based on category
31
  bbox = record["bbox"]
32
  category_id = record["category_id"]
33
+ box_color = CATEGORY_COLORS.get(category_id, "yellow") # Default to blue if category not in mapping
34
  draw.rectangle([bbox[0], bbox[1], bbox[0] + bbox[2], bbox[1] + bbox[3]], outline=box_color, width=2)
35
 
36
  # Draw segmentation mask
37
  segmentation = record["segmentation"]
38
  for seg in segmentation:
39
+ draw.polygon(seg, outline="orange", width=2)
40
 
41
  # Prepare additional information
42
  area = record["area"]