Could you please guide me how to use an HourGlass Network here that is pretrained on human pose instead of this ResNet18?
num_classes = 4 * 2 #4 coordinates X and Y flattened --> 4 of 2D keypoints or landmarks

class Network(nn.Module):
    def __init__(self,num_classes=8):
        super().__init__()
        self.model_name = 'resnet18'
        self.model = models.resnet18()
        self.model.fc = nn.Linear(self.model.fc.in_features, num_classes)
        
    def forward(self, x):
        x = x.float()
        out = self.model(x)
        return out

For example, I found this Stacked Hourglass code for facial landmark detection which is a similar problem. How can I use it in my own PyTorch code such as I am calling models.resnet18()? Also, are there more standard implementations of Stacked hourglass network since it is a pretty much famous network (or any other baseline for human pose estimation with pretraining enabled)?

  
      github.com
  
  
    raymon-tian/hourglass-facekeypoints-detection/blob/master/models.py 22
#coding=utf-8
import torch
import torch.nn as nn
from torch.nn import Upsample
from torch.autograd import Variable

class HourGlass(nn.Module):
    """不改变特征图的高宽"""
    def __init__(self,n=4,f=128):
        """
        :param n: hourglass模块的层级数目
        :param f: hourglass模块中的特征图数量
        :return:
        """
        super(HourGlass,self).__init__()
        self._n = n
        self._f = f
        self._init_layers(self._n,self._f)

    def _init_layers(self,n,f):


  This file has been truncated. show original

  
  
    
    
  
  


Here’s another Hourglass code I found in PyTorch https://github.com/bearpaw/pytorch-pose/blob/master/pose/models/hourglass.py 15