BaşlayınÜcretsiz Başlayın

Box regressor block

Your final task is to create a regressor block to predict bounding box coordinates. You decide to have a block with 2 fully connected layers with a ReLU activation in between, similar to the classifier you defined earlier.

Your vgg_model and input_dim are still available and torch and torchvision.models have been imported.

Bu egzersiz

Deep Learning for Images with PyTorch

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Create a variable num_coordinates with the number of boundary box coordinates to predict.
  • Define the appropriate input dimension for the first linear layer and set the output dimension to 32.
  • Define the appropriate output dimension in the regressor's last layer.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Define the number of coordinates
____

bb = nn.Sequential(  
	# Add input and output dimensions
	nn.Linear(____, ____),
	nn.ReLU(),
	# Add the output for the last regression layer
	nn.Linear(32, ____),
)
Kodu Düzenle ve Çalıştır