Skip to content

Commit

Permalink
refactor(deepen/download_annotations): minor fix for more user friend…
Browse files Browse the repository at this point in the history
…ly tool

Signed-off-by: kminoda <[email protected]>
  • Loading branch information
kminoda committed Dec 18, 2024
1 parent 212647a commit da3500e
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions perception_dataset/deepen/download_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,12 @@

CLIENT_ID = os.environ["DEEPEN_CLIENT_ID"]
ACCESS_TOKEN = os.environ["DEEPEN_ACCESS_TOKEN"]
DATSETS_URL = (
DATASETS_URL = (
f"https://tools.deepen.ai/api/v2/clients/{CLIENT_ID}/labels_of_dataset_ids?labelSetId=default"
)

today = str(date.today()).replace("-", "")


# def get_dataset():
# URL = f"https://tools.deepen.ai/api/v2/datasets/{DATASET_ID}/labels?filter_existing_categories=true&final=true&all=true"
# print(URL)

# headers = {
# "Authorization": f"Bearer {os.environ['DEEPEN_ACCESS_TOKEN']}",
# }
# response = requests.get(URL, headers=headers)
# print(response.status_code)
# pprint(response.json())


def get_datasets(dataset_ids: List[str], dataset_dir: str, output_name: str):
headers = {
"Authorization": f"Bearer {ACCESS_TOKEN}",
Expand All @@ -36,7 +23,7 @@ def get_datasets(dataset_ids: List[str], dataset_dir: str, output_name: str):
data = {"dataset_ids": dataset_ids}

try:
response = requests.post(DATSETS_URL, headers=headers, data=json.dumps(data))
response = requests.post(DATASETS_URL, headers=headers, data=json.dumps(data))
response.raise_for_status()
except requests.exceptions.RequestException as e:
raise SystemExit(e)
Expand Down Expand Up @@ -73,4 +60,6 @@ def get_datasets(dataset_ids: List[str], dataset_dir: str, output_name: str):
dataset_ids = list(config["conversion"]["dataset_corresponding"].values())
output_name = config["conversion"]["input_anno_file"]

print("Requesting annotated json for: ", dataset_ids)

get_datasets(dataset_ids, args.output_dir, output_name)

0 comments on commit da3500e

Please sign in to comment.