File size: 1,902 Bytes
c8b3252
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
"""

Create minimal sample data for the Fish Detection project to run end-to-end.

This creates dummy images and CSV files that match the expected format.

"""
import os
import pandas as pd
from PIL import Image
import numpy as np

# Create directory structure
os.makedirs("./data/images", exist_ok=True)
os.makedirs("./data/output", exist_ok=True)

# Create 5 dummy images (100x100 RGB)
num_images = 5
for i in range(num_images):
    img = Image.fromarray(np.random.randint(0, 255, (100, 100, 3), dtype=np.uint8))
    img.save(f"./data/images/image_{i}.jpg")

# Create dummy CSVs with the expected format
# Columns: image_name, x1, y1, x2, y2, label
# The columns x1, y1, x2, y2, label contain lists (literal strings)

data_train = {
    'image_name': ['image_0.jpg', 'image_1.jpg'],
    'x1': ['[10, 30]', '[20]'],
    'y1': ['[15, 35]', '[25]'],
    'x2': ['[40, 60]', '[50]'],
    'y2': ['[45, 65]', '[55]'],
    'label': ['[1, 2]', '[1]']
}

data_val = {
    'image_name': ['image_2.jpg'],
    'x1': ['[10]'],
    'y1': ['[15]'],
    'x2': ['[40]'],
    'y2': ['[45]'],
    'label': ['[2]']
}

data_test = {
    'image_name': ['image_3.jpg', 'image_4.jpg'],
    'x1': ['[10, 30]', '[20]'],
    'y1': ['[15, 35]', '[25]'],
    'x2': ['[40, 60]', '[50]'],
    'y2': ['[45, 65]', '[55]'],
    'label': ['[1, 2]', '[1]']
}

df_train = pd.DataFrame(data_train)
df_val = pd.DataFrame(data_val)
df_test = pd.DataFrame(data_test)

df_train.to_csv('./data/output/style_train.csv', index=False)
df_val.to_csv('./data/output/validation.csv', index=False)
df_test.to_csv('./data/output/test.csv', index=False)

print("✓ Created sample data:")
print("  - ./data/images/ with 5 dummy images")
print("  - ./data/output/style_train.csv (2 samples)")
print("  - ./data/output/validation.csv (1 sample)")
print("  - ./data/output/test.csv (2 samples)")