Update WaterFlowCountersRecognition.py
Browse files
WaterFlowCountersRecognition.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
import json
|
| 2 |
import os
|
| 3 |
-
import collections
|
| 4 |
|
| 5 |
import datasets
|
| 6 |
|
|
@@ -49,11 +48,11 @@ class WaterFlowCounter(datasets.GeneratorBasedBuilder):
|
|
| 49 |
name="WFCR_full",
|
| 50 |
description="Full dataset which contains coordinates and names of regions and information about rotation",
|
| 51 |
data_url={
|
| 52 |
-
"train": "
|
| 53 |
-
"test": "
|
| 54 |
},
|
| 55 |
metadata_url={
|
| 56 |
-
'full': "
|
| 57 |
}
|
| 58 |
)
|
| 59 |
]
|
|
@@ -131,7 +130,7 @@ class WaterFlowCounter(datasets.GeneratorBasedBuilder):
|
|
| 131 |
for el in annotations['_via_img_metadata']:
|
| 132 |
|
| 133 |
if annotations['_via_img_metadata'][el]['filename'] == file:
|
| 134 |
-
|
| 135 |
for region in annotations['_via_img_metadata'][el]['regions']:
|
| 136 |
all_x.append(region['shape_attributes']['all_points_x'])
|
| 137 |
all_y.append(region['shape_attributes']['all_points_y'])
|
|
@@ -140,7 +139,7 @@ class WaterFlowCounter(datasets.GeneratorBasedBuilder):
|
|
| 140 |
rotated = [rotation_to_id[list(region['region_attributes']['rotated'].keys())[0]]]
|
| 141 |
except:
|
| 142 |
rotated = [int(region['region_attributes']['rotated'])]
|
| 143 |
-
|
| 144 |
|
| 145 |
yield idx, {
|
| 146 |
"image": {"path": filepath, "bytes": image_bytes},
|
|
|
|
| 1 |
import json
|
| 2 |
import os
|
|
|
|
| 3 |
|
| 4 |
import datasets
|
| 5 |
|
|
|
|
| 48 |
name="WFCR_full",
|
| 49 |
description="Full dataset which contains coordinates and names of regions and information about rotation",
|
| 50 |
data_url={
|
| 51 |
+
"train": "data/train_photos.zip",
|
| 52 |
+
"test": "data/test_photos.zip",
|
| 53 |
},
|
| 54 |
metadata_url={
|
| 55 |
+
'full': "data/WaterFlowCounter.json"
|
| 56 |
}
|
| 57 |
)
|
| 58 |
]
|
|
|
|
| 130 |
for el in annotations['_via_img_metadata']:
|
| 131 |
|
| 132 |
if annotations['_via_img_metadata'][el]['filename'] == file:
|
| 133 |
+
|
| 134 |
for region in annotations['_via_img_metadata'][el]['regions']:
|
| 135 |
all_x.append(region['shape_attributes']['all_points_x'])
|
| 136 |
all_y.append(region['shape_attributes']['all_points_y'])
|
|
|
|
| 139 |
rotated = [rotation_to_id[list(region['region_attributes']['rotated'].keys())[0]]]
|
| 140 |
except:
|
| 141 |
rotated = [int(region['region_attributes']['rotated'])]
|
| 142 |
+
|
| 143 |
|
| 144 |
yield idx, {
|
| 145 |
"image": {"path": filepath, "bytes": image_bytes},
|