MulaiMulai sekarang secara gratis

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.

Latihan ini adalah bagian dari kursus

Deep Learning for Images with PyTorch

Lihat Kursus

Petunjuk latihan

  • 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.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# 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, ____),
)
Edit dan Jalankan Kode