cd7fc53a118063d64dfb1b659cfb6fe4bfe9feda,gluoncv/model_zoo/yolo/yolo3.py,YOLOV3,reset_class,#YOLOV3#,440

Before Change


                        reuse_weights[k] = v
                    if isinstance(k, str):
                        try:
                            new_idx = self._classes.index(k)  // raise ValueError if not found
                        except ValueError:
                            raise ValueError(
                                "{} not found in new class names {}".format(k, self._classes))

After Change


        if isinstance(reuse_weights, (dict, list)):
            if isinstance(reuse_weights, dict):
                // trying to replace str with indices
                new_keys = []
                new_vals = []
                for k, v in reuse_weights.items():
                    if isinstance(v, str):
                        try:
                            new_vals.append(old_classes.index(v))  // raise ValueError if not found
                        except ValueError:
                            raise ValueError(
                                "{} not found in old class names {}".format(v, old_classes))
                    else:
                        if v < 0 or v >= len(old_classes):
                            raise ValueError(
                                "Index {} out of bounds for old class names".format(v))
                        new_vals.append(v)
                    if isinstance(k, str):
                        try:
                            new_keys.append(self.classes.index(k))  // raise ValueError if not found
                        except ValueError:
                            raise ValueError(
                                "{} not found in new class names {}".format(k, self.classes))
                    else:
                        if k < 0 or k >= len(self.classes):
                            raise ValueError(
                                "Index {} out of bounds for new class names".format(k))
                        new_keys.append(k)
                reuse_weights = dict(zip(new_keys, new_vals))
            else:
                new_map = {}
                for x in reuse_weights:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 13

Instances


Project Name: dmlc/gluon-cv
Commit Name: cd7fc53a118063d64dfb1b659cfb6fe4bfe9feda
Time: 2019-08-23
Author: 33575288+douglas125@users.noreply.github.com
File Name: gluoncv/model_zoo/yolo/yolo3.py
Class Name: YOLOV3
Method Name: reset_class


Project Name: dmlc/gluon-cv
Commit Name: cd7fc53a118063d64dfb1b659cfb6fe4bfe9feda
Time: 2019-08-23
Author: 33575288+douglas125@users.noreply.github.com
File Name: gluoncv/model_zoo/ssd/ssd.py
Class Name: SSD
Method Name: reset_class


Project Name: dmlc/gluon-cv
Commit Name: cd7fc53a118063d64dfb1b659cfb6fe4bfe9feda
Time: 2019-08-23
Author: 33575288+douglas125@users.noreply.github.com
File Name: gluoncv/model_zoo/yolo/yolo3.py
Class Name: YOLOV3
Method Name: reset_class