hturki / suds

Scalable Urban Dynamic Scenes
MIT License
199 stars 16 forks source link

Potentially redundant for-loop in extract_dino_correspondences.py #27

Closed dllu closed 1 year ago

dllu commented 1 year ago

I see the following code:

https://github.com/hturki/suds/blob/main/scripts/extract_dino_correspondences.py#L96

    for k in range(n_clusters):
        for i, (label, rank) in enumerate(zip(kmeans.labels_, ranks)):
            if rank > bb_topk_sims[label]:
                bb_topk_sims[label] = rank
                bb_indices_to_show[label] = i

I don't understand the outermost for-loop. It doesn't seem to affect any computation.

Moreover, I find that this loop is taking up 80% of the total run time (another 15% is taken up by k means, so overall the GPU utilization is quite poor).

image (52)

fferroni commented 1 year ago

you are correct. nice catch