jebin2 commited on
Commit
c458a5a
Β·
1 Parent(s): c13ce0c
.gitignore CHANGED
@@ -218,4 +218,6 @@ test*.jpg
218
  yolo_output/
219
  *:Zone.Identifier
220
  comic_panel_extractor/best.pt
221
- *.pt
 
 
 
218
  yolo_output/
219
  *:Zone.Identifier
220
  comic_panel_extractor/best.pt
221
+ *.pt
222
+ comic_panel_extractor/filtered_comic.yaml
223
+ comic_panel_extractor/filtered_dataset
comic_panel_extractor/train.py CHANGED
@@ -8,13 +8,13 @@ import os
8
  from pathlib import Path
9
  import shutil
10
 
11
- def create_filtered_dataset(original_dataset_path, output_base_path):
12
  """
13
  Create a filtered dataset with only images that have non-empty labels
14
  """
15
- shutil.rmtree(f'{original_dataset_path}/filtered_dataset', ignore_errors=True)
16
- original_path = Path(f'{original_dataset_path}/filtered_dataset')
17
- output_path = Path(output_base_path)
18
 
19
  # Create output directory structure
20
  output_images = output_path / "images"
@@ -67,11 +67,11 @@ def create_filtered_dataset(original_dataset_path, output_base_path):
67
 
68
  return filtered_counts
69
 
70
- def create_filtered_yaml(output_base_path, filtered_counts):
71
  """
72
  Create the YAML file for the filtered dataset
73
  """
74
- output_path = Path(output_base_path)
75
  yaml_path = f'{Config.current_path}/filtered_comic.yaml'
76
 
77
  # Create YAML structure
@@ -131,17 +131,17 @@ def main():
131
  if __name__ == "__main__":# Configuration
132
  # Configuration
133
  original_dataset_path = "/home/jebineinstein/git/comic-panel-extractor/comic_panel_extractor/dataset"
134
- output_base_path = "/home/jebineinstein/git/comic-panel-extractor/comic_panel_extractor"
135
 
136
  print("πŸ” Starting dataset filtering...")
137
  print(f"πŸ“‚ Source: {original_dataset_path}")
138
- print(f"πŸ“ Output: {output_base_path}")
139
 
140
  # Create filtered dataset
141
- filtered_counts = create_filtered_dataset(original_dataset_path, output_base_path)
142
 
143
  # Create YAML file
144
- yaml_path = create_filtered_yaml(output_base_path, filtered_counts)
145
 
146
  # Summary
147
  total_filtered = sum(filtered_counts.values())
 
8
  from pathlib import Path
9
  import shutil
10
 
11
+ def create_filtered_dataset(original_dataset_path, output_filtered_dataset_path):
12
  """
13
  Create a filtered dataset with only images that have non-empty labels
14
  """
15
+ shutil.rmtree(output_filtered_dataset_path, ignore_errors=True)
16
+ original_path = Path(original_dataset_path)
17
+ output_path = Path(output_filtered_dataset_path)
18
 
19
  # Create output directory structure
20
  output_images = output_path / "images"
 
67
 
68
  return filtered_counts
69
 
70
+ def create_filtered_yaml(output_filtered_dataset_path, filtered_counts):
71
  """
72
  Create the YAML file for the filtered dataset
73
  """
74
+ output_path = Path(output_filtered_dataset_path)
75
  yaml_path = f'{Config.current_path}/filtered_comic.yaml'
76
 
77
  # Create YAML structure
 
131
  if __name__ == "__main__":# Configuration
132
  # Configuration
133
  original_dataset_path = "/home/jebineinstein/git/comic-panel-extractor/comic_panel_extractor/dataset"
134
+ output_filtered_dataset_path = "/home/jebineinstein/git/comic-panel-extractor/comic_panel_extractor/filtered_dataset"
135
 
136
  print("πŸ” Starting dataset filtering...")
137
  print(f"πŸ“‚ Source: {original_dataset_path}")
138
+ print(f"πŸ“ Output: {output_filtered_dataset_path}")
139
 
140
  # Create filtered dataset
141
+ filtered_counts = create_filtered_dataset(original_dataset_path, output_filtered_dataset_path)
142
 
143
  # Create YAML file
144
+ yaml_path = create_filtered_yaml(output_filtered_dataset_path, filtered_counts)
145
 
146
  # Summary
147
  total_filtered = sum(filtered_counts.values())
comic_panel_extractor/yolo_manager.py CHANGED
@@ -68,7 +68,7 @@ class YOLOManager:
68
  print(f"πŸ“¦ Loading model from: {weights_path}")
69
  self.model = YOLO(weights_path)
70
  else:
71
- print("✨ Loading pretrained model 'yolo11s.pt'")
72
  self.model = YOLO(f"{Config.current_path}/yolo12s.pt")
73
  return self.model
74
 
@@ -111,7 +111,9 @@ class YOLOManager:
111
  'cache': True,
112
  'project': f'{Config.current_path}/runs/detect',
113
  'exist_ok': True,
114
- 'resume': resume_flag
 
 
115
  }
116
 
117
  # Update with custom parameters
 
68
  print(f"πŸ“¦ Loading model from: {weights_path}")
69
  self.model = YOLO(weights_path)
70
  else:
71
+ print("✨ Loading pretrained model 'yolo12s.pt'")
72
  self.model = YOLO(f"{Config.current_path}/yolo12s.pt")
73
  return self.model
74
 
 
111
  'cache': True,
112
  'project': f'{Config.current_path}/runs/detect',
113
  'exist_ok': True,
114
+ 'pose': False,
115
+ 'resume': resume_flag,
116
+ 'amp': False, # 🚫 Disable AMP to prevent yolo11n.pt download
117
  }
118
 
119
  # Update with custom parameters