You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create or update dataset by recursively crawling through a directory.
1255
-
A DatasetItem will be created for each unique image found.
1256
-
In case of update the existing items are skipped or updated depending on update_items param
1257
-
1245
+
Validate directory exists
1258
1246
Args:
1259
-
dirname: Where to look for image files, recursively
1260
-
dataset_id: Dataset Id for update
1261
-
dataset_name: If none is given, the parent folder name is used
1262
-
use_privacy_mode: Whether the dataset should be treated as privacy (ignored if dataset being updated)
1263
-
privacy_mode_proxy: Endpoint that serves image files for privacy mode, ignore if not using privacy mode.
1264
-
The proxy should work based on the relative path of the images in the directory.
1265
-
allowed_file_types: Which file type extensions to search for, ie: ('jpg', 'png')
1266
-
skip_size_warning: If False, it will throw an error if the script globs more than 500 images. This is a safety check in case the dirname has a typo, and grabs too much data.
1267
-
update_items: Whether to update items in existing dataset
1247
+
dirname: Path of directory
1268
1248
1269
1249
Returns:
1270
-
:class: `Dataset`: Created dataset or updated one
1250
+
Existing directory path
1271
1251
1272
1252
"""
1273
-
ifdataset_id:
1274
-
dataset=self.get_dataset(dataset_id)
1275
-
# fetch dataset use_privacy_mode for existence check
1276
-
use_privacy_mode=dataset.use_privacy_mode
1277
-
else:
1278
-
dataset=None
1279
-
ifuse_privacy_mode:
1280
-
assert (
1281
-
privacy_mode_proxy
1282
-
), "When using privacy mode, must specify a proxy to serve the files"
allowed_file_types: Which file type extensions to search for, ie: ('jpg', 'png')
1333
1281
skip_size_warning: If False, it will throw an error if the script globs more than 500 images. This is a safety check in case the dirname has a typo, and grabs too much data.
Update dataset by recursively crawling through a directory.
1355
-
A DatasetItem will be created for each unique image found.
1356
-
The existing items are skipped or updated depending on update_items param
1357
-
1358
-
Args:
1359
-
dirname: Where to look for image files, recursively
1360
-
dataset_id: ID of existing dataset to update
1361
-
privacy_mode_proxy: Endpoint that serves image files for privacy mode, ignore if not using privacy mode.
1362
-
The proxy should work based on the relative path of the images in the directory.
1363
-
allowed_file_types: Which file type extensions to search for, ie: ('jpg', 'png')
1364
-
skip_size_warning: If False, it will throw an error if the script globs more than 500 images. This is a safety check in case the dirname has a typo, and grabs too much data.
1365
-
update_items: Whether to update items in existing dataset
Update dataset by recursively crawling through a directory.
2258
+
A DatasetItem will be created for each unique image found.
2259
+
The existing items are skipped or updated depending on update_items param
2260
+
2261
+
Args:
2262
+
dirname: Where to look for image files, recursively
2263
+
existing_dirname: Already validated dirname
2264
+
privacy_mode_proxy: Endpoint that serves image files for privacy mode, ignore if not using privacy mode.
2265
+
The proxy should work based on the relative path of the images in the directory.
2266
+
allowed_file_types: Which file type extensions to search for, ie: ('jpg', 'png')
2267
+
skip_size_warning: If False, it will throw an error if the script globs more than 500 images. This is a safety check in case the dirname has a typo, and grabs too much data.
2268
+
update_items: Whether to update items in existing dataset
2269
+
"""
2270
+
# fetch dataset use_privacy_mode for existence check
2271
+
ifself.use_privacy_mode:
2272
+
assert (
2273
+
privacy_mode_proxy
2274
+
), "When using privacy mode, must specify a proxy to serve the files"
0 commit comments