์ฝ˜ํ…์ธ ๋กœ ๊ฑด๋„ˆ๋›ฐ๊ธฐ

Ultralytics HUB -SDK๋ฅผ ์‚ฌ์šฉํ•œ ๋ฐ์ดํ„ฐ ์„ธํŠธ ๊ด€๋ฆฌ ์ž‘์—…

Ultralytics HUB -SDK ๋ฐ์ดํ„ฐ ์„ธํŠธ ๊ด€๋ฆฌ ๋ฌธ์„œ์— ์˜ค์‹  ๊ฒƒ์„ ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค! ๐Ÿ‘‹

๋ฐ์ดํ„ฐ ์ง‘ํ•ฉ์„ ํšจ์œจ์ ์œผ๋กœ ๊ด€๋ฆฌํ•˜๋Š” ๊ฒƒ์€ ๋จธ์‹  ๋Ÿฌ๋‹์˜ ์„ธ๊ณ„์—์„œ ๋งค์šฐ ์ค‘์š”ํ•ฉ๋‹ˆ๋‹ค. ์ˆ™๋ จ๋œ ๋ฐ์ดํ„ฐ ๊ณผํ•™์ž๋“  ์ด ๋ถ„์•ผ์˜ ์ดˆ๋ณด์ž์ด๋“ , ๋ฐ์ดํ„ฐ ์ง‘ํ•ฉ ์ž‘์—…์„ ์ฒ˜๋ฆฌํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์•Œ๋ฉด ์›Œํฌํ”Œ๋กœ์šฐ๋ฅผ ๊ฐ„์†Œํ™”ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ํŽ˜์ด์ง€์—์„œ๋Š” Python ์—์„œ Ultralytics HUB -SDK ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ฐ์ดํ„ฐ ์„ธํŠธ์— ๋Œ€ํ•œ ์ž‘์—…์„ ์ˆ˜ํ–‰ํ•˜๋Š” ๊ธฐ๋ณธ ์‚ฌํ•ญ์„ ๋‹ค๋ฃน๋‹ˆ๋‹ค. ์ œ๊ณต๋œ ์˜ˆ์ œ์—์„œ๋Š” ๋ฐ์ดํ„ฐ ์ง‘ํ•ฉ์„ ๊ฐ€์ ธ์˜ค๊ณ , ๋งŒ๋“ค๊ณ , ์—…๋ฐ์ดํŠธํ•˜๊ณ , ์‚ญ์ œํ•˜๊ณ , ๋ฐ์ดํ„ฐ ์ง‘ํ•ฉ์„ ๋‚˜์—ดํ•˜๊ณ , ๋ฐ์ดํ„ฐ ์ง‘ํ•ฉ ์•ก์„ธ์Šค๋ฅผ ์œ„ํ•œ URL์„ ์–ป๊ณ , ๋ฐ์ดํ„ฐ ์ง‘ํ•ฉ์„ ์—…๋กœ๋“œํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์„ค๋ช…ํ•ฉ๋‹ˆ๋‹ค.

์‹œ์ž‘ํ•ด๋ณด์ž! ๐Ÿš€

ID๋กœ ๋ฐ์ดํ„ฐ ์ง‘ํ•ฉ ๊ฐ€์ ธ์˜ค๊ธฐ

ํŠน์ • ๋ฐ์ดํ„ฐ์„ธํŠธ๋ฅผ ์ฐพ๊ณ  ๊ณ„์‹ ๊ฐ€์š”? ์•„๋ž˜ ์ฝ”๋“œ ์Šค๋‹ˆํŽซ๊ณผ ํ•จ๊ป˜ ๊ณ ์œ  ID๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋น ๋ฅด๊ฒŒ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ํ•ด๋‹น ๋ฐ์ดํ„ฐ๋ฅผ ํฌํ•จํ•œ ํ•„์ˆ˜ ์ •๋ณด์— ์•ก์„ธ์Šคํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

# Fetch a dataset by ID
dataset = client.dataset('<Dataset ID>')  # Replace with your actual Dataset ID
print(dataset.data)  # This prints the dataset information

๋ฐ์ดํ„ฐ ์ง‘ํ•ฉ ๋งŒ๋“ค๊ธฐ

์ƒˆ ํ”„๋กœ์ ํŠธ๋ฅผ ์‹œ์ž‘ํ•  ์ค€๋น„๊ฐ€ ๋˜์…จ๋‚˜์š”? ์•„๋ž˜ ๋‹จ๊ณ„์— ๋”ฐ๋ผ ์ƒˆ ๋ฐ์ดํ„ฐ ์ง‘ํ•ฉ์„ ๋งŒ๋“œ์„ธ์š”. ๋ฐ์ดํ„ฐ ์ง‘ํ•ฉ์˜ ์ด๋ฆ„์„ ์นœ์ˆ™ํ•œ ์ด๋ฆ„์œผ๋กœ ์ •์˜ํ•˜๊ณ  create_dataset ๋ฉ”์„œ๋“œ.

# Import client library comes before this snippet

# Define your dataset properties
data = {"meta": {"name": "My Dataset"}}  # Replace 'My Dataset' with your desired dataset name

# Create the dataset
dataset = client.dataset()
dataset.create_dataset(data)
print("Dataset created successfully!")

๋ฐ์ดํ„ฐ ์ง‘ํ•ฉ ์—…๋ฐ์ดํŠธ

ํ”„๋กœ์ ํŠธ๊ฐ€ ๋ฐœ์ „ํ•จ์— ๋”ฐ๋ผ ๋ฐ์ดํ„ฐ ์„ธํŠธ๋„ ๋ฐœ์ „ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๋ฐ์ดํ„ฐ ์„ธํŠธ์˜ ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ๋ฅผ ์ˆ˜์ •ํ•ด์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ, ์ƒˆ ์„ธ๋ถ€ ์ •๋ณด๋กœ ๋‹ค์Œ ์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•˜๊ธฐ๋งŒ ํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค.

# Obtain the dataset
dataset = client.dataset("<Dataset ID>")  # Insert the correct Dataset ID

# Update the dataset's metadata
dataset.update({"meta": {"name": "Updated Name"}})  # Modify 'Updated Name' as required
print("Dataset updated with new information.")

๋ฐ์ดํ„ฐ ์„ธํŠธ ์‚ญ์ œ

์ž‘์—… ๊ณต๊ฐ„์„ ์ •๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด ๋˜๋Š” ๋” ์ด์ƒ ํ•„์š”ํ•˜์ง€ ์•Š์•„์„œ ๋ฐ์ดํ„ฐ ์ง‘ํ•ฉ์„ ์ œ๊ฑฐํ•ด์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ, ๋ฐ์ดํ„ฐ ์ง‘ํ•ฉ์„ ์˜๊ตฌ์ ์œผ๋กœ ์‚ญ์ œํ•˜๊ธฐ ์œ„ํ•ด delete ๋ฉ”์„œ๋“œ๋ฅผ ํ˜ธ์ถœํ•ฉ๋‹ˆ๋‹ค.

# Select the dataset by its ID
dataset = client.dataset('<Dataset ID>')  # Ensure the Dataset ID is specified

# Delete the dataset
dataset.delete()
print("Dataset has been deleted.")

๋ฐ์ดํ„ฐ ์ง‘ํ•ฉ ๋‚˜์—ด

๋ฐ์ดํ„ฐ ์ง‘ํ•ฉ์„ ํƒ์ƒ‰ํ•˜๊ฑฐ๋‚˜ ํ•„์š”ํ•œ ๋ฐ์ดํ„ฐ ์ง‘ํ•ฉ์„ ์ฐพ์œผ๋ ค๋ฉด ํŽ˜์ด์ง€ ๋งค๊น€์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ชจ๋“  ๋ฐ์ดํ„ฐ ์ง‘ํ•ฉ์„ ๋‚˜์—ดํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋งŽ์€ ์ˆ˜์˜ ๋ฐ์ดํ„ฐ ์ง‘ํ•ฉ์„ ๋‹ค๋ฃฐ ๋•Œ ์œ ์šฉํ•ฉ๋‹ˆ๋‹ค.

# Retrieve the first page of datasets
dataset = client.dataset_list(page_size=10)
print("Current dataset:", dataset.results)  # Show the datasets on the current page

# Move to the next page and show results
dataset.next()
print("Next page result:", dataset.results)

# Go back to the previous page
dataset.previous()
print("Previous page result:", dataset.results)

์Šคํ† ๋ฆฌ์ง€์—์„œ URL ๊ฐ€์ ธ์˜ค๊ธฐ

์ด ํŽธ๋ฆฌํ•œ ๊ธฐ๋Šฅ์€ ๋ฐ์ดํ„ฐ ์„ธํŠธ ์ €์žฅ์†Œ ์•ก์„ธ์Šค๋ฅผ ์œ„ํ•œ URL์„ ๊ฐ€์ ธ์˜ค๊ธฐ ๋•Œ๋ฌธ์— ์›๊ฒฉ์œผ๋กœ ์ €์žฅ๋œ ๋ฐ์ดํ„ฐ ์„ธํŠธ ํŒŒ์ผ์ด๋‚˜ ์•„ํ‹ฐํŒฉํŠธ๋ฅผ ์‰ฝ๊ฒŒ ๋‹ค์šด๋กœ๋“œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

# Define the dataset ID for which you want a download link
datasetId = "<Dataset ID>"  # Don't forget to replace this with the actual dataset ID
dataset = client.dataset(datasetId)

# Retrieve the URL for downloading dataset contents
url = dataset.get_download_link("archive")
print("Download URL:", url)

๋ฐ์ดํ„ฐ ์„ธํŠธ ์—…๋กœ๋“œ

๋ฐ์ดํ„ฐ์…‹์„ ์—…๋กœ๋“œํ•˜๋Š” ๊ณผ์ •์€ ๊ฐ„๋‹จํ•ฉ๋‹ˆ๋‹ค. ๋ฐ์ดํ„ฐ ์„ธํŠธ์˜ ID์™€ ์—…๋กœ๋“œํ•˜๋ ค๋Š” ํŒŒ์ผ ๊ฒฝ๋กœ๋ฅผ ์„ค์ •ํ•œ ๋‹ค์Œ, ๋ฐ์ดํ„ฐ ์„ธํŠธ์˜ upload_dataset ํ•จ์ˆ˜๋Š” ์•„๋ž˜์— ์ž์„ธํžˆ ์„ค๋ช…๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

# Set your dataset ID
dataset_id = "<Dataset ID>"  # Substitute with the real dataset ID

# Select the dataset
dataset = client.dataset(dataset_id)

# Upload the dataset file
dataset.upload_dataset(file="<Dataset File>")  # Make sure to specify the correct file path
print("Dataset has been uploaded.")

๋ฐ์ดํ„ฐ ์ง‘ํ•ฉ์œผ๋กœ ์ž‘์—…ํ•  ๋•Œ๋Š” ํ•ญ์ƒ ํ”„๋กœ์„ธ์Šค์˜ ๊ฐ ๋‹จ๊ณ„๋ฅผ ํ™•์ธํ•˜๊ณ  ํ™•์ธํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค. ๋ฐ์ดํ„ฐ ์„ธํŠธ ID์™€ ํŒŒ์ผ ๊ฒฝ๋กœ๋ฅผ ๋‹ค์‹œ ํ•œ ๋ฒˆ ํ™•์ธํ•˜์—ฌ ๋ชจ๋“  ๊ฒƒ์ด ์›ํ™œํ•˜๊ฒŒ ์‹คํ–‰๋˜๋„๋ก ํ•˜์„ธ์š”.

๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•˜๊ฑฐ๋‚˜ ๊ถ๊ธˆํ•œ ์ ์ด ์žˆ๋Š” ๊ฒฝ์šฐ, ์นœ์ ˆํ•œ ์ง€์›ํŒ€์—์„œ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๋„๋ก ๋„์™€๋“œ๋ฆฝ๋‹ˆ๋‹ค. ๐Ÿค

ํ–‰๋ณตํ•œ ๋ฐ์ดํ„ฐ ๋žญ๊ธ€๋ง์„ ํ†ตํ•ด ์ •ํ™•ํ•˜๊ณ  ํ†ต์ฐฐ๋ ฅ ์žˆ๋Š” ๋ชจ๋ธ์„ ๋งŒ๋“ค ์ˆ˜ ์žˆ๊ธฐ๋ฅผ ๋ฐ”๋ž๋‹ˆ๋‹ค! ๐ŸŒŸ


๋Œ“๊ธ€