Quantcast
Channel: TAO Toolkit - NVIDIA Developer Forums
Viewing all articles
Browse latest Browse all 409

TAO 5.3, YOLOv4 : Retrieving kmeans 'anchor shapes' through API call

$
0
0

Hi,

  • I’m using TAO API 5.3 on AWS EKS, T4 GPU hardware.
  • I’m training YOLOv4 on a custom kitti image dataset.
  • I’ve successfully run the dataset_convert action on my train and val sets.
  • To obtain YOLOv4 anchors, I’ve modified the kmeans default spec to include size_x and size_y, and successfully run the kmeans action over my dataset. The job runs successfully, but the output does not contain anchor shapes that I need for yolov4_config in the training spec file.

Question: Via the API, how do I retrieve anchor shapes that result from running kmeans action?

Specifically referring to this step. Output is expected to be 3 tuples, something like this:

Code:

## Default specs; from {base_url}/datasets/{dataset_id}/specs/kmeans/schema"
specs = response.json()["default"]
specs["size_x"] = 512
specs["size_y"] = 512

## Kick off the kmeans job
parent = parent_id
action = "kmeans"
data = json.dumps({"parent_job_id": parent, "action": action, "specs": specs})
endpoint = f"{base_url}/datasets/{dataset_id}/jobs"
response = requests.post(endpoint, data=data, headers=headers, verify=False)

print(response)

Output (notice how job status=SUCCESS, but anchor shapes are not present):

{'action': 'kmeans', 
 'created_on': '2024-10-23T01:45:46.834550', 
 'dataset_id': 'ccfaa892-c6bc-4d4d-a87e-9f3cc7fe1195', 
 'description': '', 
  'id': '5adfacfe-8432-442f-90e0-d40feb3045c6',
  'job_tar_stats': 
    {'file_size': 625, 
      'sha256_digest': 'af7be32bec080af4fa4b04ba9429ce5a5215749b41cf090047164c6a556672ce'
    }, 
    'last_modified': '2024-10-23T01:47:22.136608', 
     'name': '', 
     'parent_id': 'ec204a96-5f08-4fdf-8b32-4cb828d60cc6', 'result': {
     'categorical': [], 
     'cur_iter': None, 
     'detailed_status': {
       'date': '10/23/2024', 
       'message': 'K-means finished successfully.', 
       'status': 'SUCCESS', 
       'time': '1:47:8'
     }, 
   'epoch': None, 
   'eta': None, 
   'graphical': [], 
   'key_metric': 0.0, 
   'kpi': [], 
   'max_epoch': None, 
   'time_per_epoch': None, 
   'time_per_iter': None
  }, 
  'specs': {
    'max_steps': 10000, 
    'min_x': 0, 
    'min_y': 0, 
    'num_clusters': 9, 
    'size_x': 512, 
    'size_y': 512
  }, 
  'status': 'Done'
}

10 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 409

Trending Articles