Использование немного другой архитектуры между предварительной тренировкой и точной настройкойPython

Программы на Python
Гость
Использование немного другой архитектуры между предварительной тренировкой и точной настройкой

Сообщение Гость »


Заранее извиняюсь, если мое следующее описание недостаточно полно.
Предположим, я обучил простую модель, подобную Resnet, со следующей структурой основных блоков:

Код: Выделить всё

self.layer1 = self._make_layer(self.inplanes, outplanes[0], num_blocks = 3, stride=1)
self.layer2 = self._make_layer(self.inplanes, outplanes[1], num_blocks = 3, stride=2)
self.layer3 = self._make_layer(self.inplanes, outplanes[2], num_blocks = 3, stride=2)
self.layer4 = self._make_layer(inplanes = outplanes[2],  planes=outplanes[3], num_blocks = 3, stride=2)
Теперь я хочу выполнить тонкую настройку этой модели. Но вместо того, чтобы повторять блоки одной и той же формы 3 раза, я хочу объединить их в один слой и загрузить в свою модель точной настройки:

Код: Выделить всё

self.layer1 = self._make_layer(self.inplanes, outplanes[0], num_blocks = 1, stride=1)
self.layer2 = self._make_layer(self.inplanes, outplanes[1], num_blocks = 1, stride=2)
self.layer3 = self._make_layer(self.inplanes, outplanes[2], num_blocks = 1, stride=2)
self.layer4 = self._make_layer(inplanes = outplanes[2],  planes=outplanes[3], num_blocks = 1, stride=2)
So essentially, it's the same model, but I am reducing the number of repeatation by condensing the learned weights into a single one. To be noted that the repeated blocks all have the same shape.
Is there any way to implement this or it's simply not mathematically or theoretically correct? I think it's somewhat similar to knowledge distillation - conceptually?
In fact, I was thinking whether I could also modify the kernel size similarly.


Источник: https://stackoverflow.com/questions/781 ... ine-tuning

Вернуться в «Python»