当前位置:网站首页>[Syntax sugar] About the mapping of category strings to category numeric ids

[Syntax sugar] About the mapping of category strings to category numeric ids

2022-08-10 02:30:00 Master Luwen

In https://github.com/ming71/DAL, dota_dataset.py:

self.classes = ('__background__', 'plane', 'ship', 'storage-tank', 'baseball-diamond','tennis-court', 'basketball-court', 'ground-track-field', 'harbor','bridge', 'large-vehicle', 'small-vehicle', 'helicopter', 'roundabout','soccer-ball-field' , 'swimming-pool'span>)self.num_classes = len(self.classes)self.class_to_ind = dict(zip(self.classes, range(self.num_classes)))span>

The conversion from category to digital id only takes one line, wonderful, zip and dict can work together like this

原网站

版权声明
本文为[Master Luwen]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/222/202208100111546693.html