Spaces:
Build error
Build error
Small changes
Browse files- .gitignore +3 -1
- S0_PrepareDataset.py +4 -2
- S2_TimberDataset.py +1 -1
.gitignore
CHANGED
|
@@ -1,3 +1,5 @@
|
|
| 1 |
test.*
|
| 2 |
*.pt
|
| 3 |
-
__pycache__/
|
|
|
|
|
|
|
|
|
| 1 |
test.*
|
| 2 |
*.pt
|
| 3 |
+
__pycache__/
|
| 4 |
+
data/**
|
| 5 |
+
data/image/**
|
S0_PrepareDataset.py
CHANGED
|
@@ -17,11 +17,13 @@ def download_file(url, pos):
|
|
| 17 |
|
| 18 |
total_size = int(r.headers.get("content-length", 0))
|
| 19 |
block_size = 8192
|
| 20 |
-
with tqdm(total=total_size,unit="B", unit_scale=True, position=pos,
|
|
|
|
| 21 |
with open(local_filename, 'wb') as f:
|
| 22 |
for chunk in r.iter_content(chunk_size=block_size):
|
| 23 |
-
p_bar.update(len(chunk))
|
| 24 |
f.write(chunk)
|
|
|
|
|
|
|
| 25 |
return local_filename
|
| 26 |
|
| 27 |
IMAGE_DIR = "data/image"
|
|
|
|
| 17 |
|
| 18 |
total_size = int(r.headers.get("content-length", 0))
|
| 19 |
block_size = 8192
|
| 20 |
+
with tqdm(total=total_size,unit="B", unit_scale=True, position=pos,
|
| 21 |
+
desc=f"#{pos} {local_filename}", ncols=100, leave=True) as p_bar:
|
| 22 |
with open(local_filename, 'wb') as f:
|
| 23 |
for chunk in r.iter_content(chunk_size=block_size):
|
|
|
|
| 24 |
f.write(chunk)
|
| 25 |
+
with tqdm.get_lock():
|
| 26 |
+
p_bar.update(len(chunk))
|
| 27 |
return local_filename
|
| 28 |
|
| 29 |
IMAGE_DIR = "data/image"
|
S2_TimberDataset.py
CHANGED
|
@@ -9,7 +9,7 @@ import pandas as pd
|
|
| 9 |
# 3264 x 2448
|
| 10 |
|
| 11 |
DATA_DIR = "data/image/train"
|
| 12 |
-
labels =
|
| 13 |
label2id = {label:id for id, label in enumerate(labels)}
|
| 14 |
|
| 15 |
def compile_image_df(data_dir:str, split_at = 0.9)-> pd.DataFrame:
|
|
|
|
| 9 |
# 3264 x 2448
|
| 10 |
|
| 11 |
DATA_DIR = "data/image/train"
|
| 12 |
+
labels = os.listdir(DATA_DIR)
|
| 13 |
label2id = {label:id for id, label in enumerate(labels)}
|
| 14 |
|
| 15 |
def compile_image_df(data_dir:str, split_at = 0.9)-> pd.DataFrame:
|