From c8a4eb5d3ffef2c33de043298497970733b23f1d Mon Sep 17 00:00:00 2001 From: Marcel Simon Date: Sat, 31 Aug 2019 08:02:27 +0000 Subject: [PATCH] Added assert to data loader (checking label smoothing works) --- PyTorchClassification/data_loader.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PyTorchClassification/data_loader.py b/PyTorchClassification/data_loader.py index 7e06635..1252776 100644 --- a/PyTorchClassification/data_loader.py +++ b/PyTorchClassification/data_loader.py @@ -346,6 +346,10 @@ class JSONDataset(data.Dataset): if (dataFormat2017): # self.tax_levels = ['id', 'name', 'supercategory'] self.tax_levels = ['id', 'name'] + if label_smoothing > 0: + assert len(self.tax_levels) == 3, "Please comment in the line above to include the taxonomy " + \ + "level 'supercategory' in order for label smoothing to work. It should look like this: " + \ + "self.tax_levels = ['id', 'name', 'supercategory']" else: self.tax_levels = ['id', 'genus', 'family', 'order', 'class', 'phylum', 'kingdom'] #8142, 4412, 1120, 273, 57, 25, 6