Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- README.md +114 -0
- VehicleWorld.csv +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
VehicleWorld.csv filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
pretty_name: "VehicleWorld Database Snippets"
|
| 6 |
+
tags:
|
| 7 |
+
- code
|
| 8 |
+
- simulation
|
| 9 |
+
- autonomous-driving
|
| 10 |
+
|
| 11 |
+
# --- 这是驱动数据预览器的关键部分 ---
|
| 12 |
+
dataset_info:
|
| 13 |
+
features:
|
| 14 |
+
- name: path
|
| 15 |
+
dtype: string
|
| 16 |
+
- name: execute.py
|
| 17 |
+
dtype: string
|
| 18 |
+
- name: inits
|
| 19 |
+
dtype: string
|
| 20 |
+
- name: modules
|
| 21 |
+
dtype: string
|
| 22 |
+
- name: querys
|
| 23 |
+
dtype: string
|
| 24 |
+
- name: raw
|
| 25 |
+
dtype: string
|
| 26 |
+
- name: worlds.json
|
| 27 |
+
dtype: string
|
| 28 |
+
splits:
|
| 29 |
+
- name: train
|
| 30 |
+
num_bytes: 155973757
|
| 31 |
+
num_examples: 1291
|
| 32 |
+
download_size: 155973757
|
| 33 |
+
dataset_size: 1291
|
| 34 |
+
# ------------------------------------
|
| 35 |
+
|
| 36 |
+
---
|
| 37 |
+
|
| 38 |
+
# VehicleWorld Database
|
| 39 |
+
Run the following code to convert csv to raw dataset
|
| 40 |
+
|
| 41 |
+
```python
|
| 42 |
+
import os
|
| 43 |
+
import csv
|
| 44 |
+
import sys
|
| 45 |
+
|
| 46 |
+
def csv_to_directory(csv_file, target_dir):
|
| 47 |
+
"""
|
| 48 |
+
Reads a CSV file and creates a directory structure based on its content.
|
| 49 |
+
|
| 50 |
+
Args:
|
| 51 |
+
csv_file (str): The path to the input CSV file.
|
| 52 |
+
target_dir (str): The path to the target directory where the structure will be created.
|
| 53 |
+
"""
|
| 54 |
+
if not os.path.isfile(csv_file):
|
| 55 |
+
# Using sys.stderr for error messages is a good practice.
|
| 56 |
+
sys.stderr.write(f"Error: CSV file '{csv_file}' not found.\n")
|
| 57 |
+
return
|
| 58 |
+
|
| 59 |
+
os.makedirs(target_dir, exist_ok=True)
|
| 60 |
+
|
| 61 |
+
# Handle large fields in CSV
|
| 62 |
+
max_int = sys.maxsize
|
| 63 |
+
while True:
|
| 64 |
+
try:
|
| 65 |
+
csv.field_size_limit(max_int)
|
| 66 |
+
break
|
| 67 |
+
except OverflowError:
|
| 68 |
+
max_int = int(max_int / 10)
|
| 69 |
+
|
| 70 |
+
try:
|
| 71 |
+
with open(csv_file, 'r', encoding='utf-8') as csvfile:
|
| 72 |
+
reader = csv.DictReader(csvfile)
|
| 73 |
+
|
| 74 |
+
if not reader.fieldnames:
|
| 75 |
+
sys.stderr.write("Error: CSV file is empty or has no header row.\n")
|
| 76 |
+
return
|
| 77 |
+
|
| 78 |
+
filenames = [header for header in reader.fieldnames if header != 'path']
|
| 79 |
+
|
| 80 |
+
for row in reader:
|
| 81 |
+
subdir_name = row.get('path')
|
| 82 |
+
if not subdir_name:
|
| 83 |
+
# It's better to inform about skipped rows.
|
| 84 |
+
sys.stderr.write("Warning: Skipping a row because 'path' value is missing.\n")
|
| 85 |
+
continue
|
| 86 |
+
|
| 87 |
+
full_subdir_path = os.path.join(target_dir, subdir_name)
|
| 88 |
+
os.makedirs(full_subdir_path, exist_ok=True)
|
| 89 |
+
|
| 90 |
+
for filename in filenames:
|
| 91 |
+
file_path = os.path.join(full_subdir_path, filename)
|
| 92 |
+
content = row.get(filename, "")
|
| 93 |
+
|
| 94 |
+
try:
|
| 95 |
+
with open(file_path, 'w', encoding='utf-8') as f:
|
| 96 |
+
f.write(content)
|
| 97 |
+
except IOError as e:
|
| 98 |
+
sys.stderr.write(f"Error: Could not write to file '{file_path}': {e}\n")
|
| 99 |
+
|
| 100 |
+
except Exception as e:
|
| 101 |
+
sys.stderr.write(f"An unexpected error occurred while processing the CSV file: {e}\n")
|
| 102 |
+
|
| 103 |
+
if __name__ == "__main__":
|
| 104 |
+
# It is recommended to use command-line arguments for file paths
|
| 105 |
+
# for better script reusability.
|
| 106 |
+
if len(sys.argv) != 3:
|
| 107 |
+
print("Usage: python your_script_name.py <path_to_csv> <target_directory>")
|
| 108 |
+
sys.exit(1)
|
| 109 |
+
|
| 110 |
+
csv_input_file = sys.argv[1]
|
| 111 |
+
output_directory = sys.argv[2]
|
| 112 |
+
|
| 113 |
+
csv_to_directory(csv_input_file, output_directory)
|
| 114 |
+
```
|
VehicleWorld.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1cf256b172155b7244219920b282a6b5e4aa9054f21d6168d1c1a94cf13a125e
|
| 3 |
+
size 155973743
|