Tensors
PyTorch
Image Data
Labeling
Bonus
100

What's a tensor?

A multi-dimensional array used to store data, like a list or matrix.

100

What command imports PyTorch?

import torch

100

What library helps us view images in Colab?

matplotlib.pyplot

100

What tool do we use to label tomato images?

LabelImg

100

What shape would a batch of 10 RGB images (32x32) have in tensors?

Hint: (x, x, x, x)

(10, 3, 32, 32)

200

What’s the shape of a 2D tensor with 3 rows and 4 columns?

Hint: print(tensor.shape)

(3, 4)

200

What does torch.tensor([1, 2, 3]) create?

A 1D tensor (vector) with values [1, 2, 3]

200

What are the RGB channels?

Red, Green, and Blue — the 3 color channels in an image

200

What format are annotations saved in using LabelImg?

Pascal VOC format (.xml files)

200

What is the difference between train, val, and test sets?

train: learns; val: tunes; test: evaluates final performance

300

What does .unsqueeze(0) do to a 2D tensor?

a 2D tensor?It adds a new dimension at position 0, turning a (2D) tensor into 3D.

300

What does torch.rand(3,3) generate?

A 3x3 tensor with random values between 0 and 1

300

Why is it important to shuffle your training data?

To prevent the model from learning the order of the data instead of the actual patterns.

300

What does XML stand for?

Extensible Markup Language

300

What’s the difference between a list and a tensor?

A list is a basic Python container, while a tensor is a multi-dimensional array used for numerical computations in libraries like PyTorch.

400

What's the difference between a vector and a matrix?

A vector is 1D, a matrix is 2D (has rows and columns).

400

What does nn.Conv2d do?

Applies convolution filters over image data

400

What is a kernel in the context of image analysis?

A small matrix used during a convolution to detect patterns like edges or textures in an image.

400

What does pandas help us do with XML files?

Convert data to a DataFrame or CSV for use in ML models

400

What Python library do we use for bounding box drawing?

PIL.ImageDraw or OpenCV

500

How do you calculate the mean along columns in a 2D tensor?

Use .mean(dim=0)

500

Why do we need to convert tensors to .float() sometimes?

To perform operations like .mean() that require floating point numbers

500

What does padding=1 do during convolution?

convolution?It adds a 1-pixel border so output size stays the same as input

500

What’s one advantage of converting to CSV format?

Easier to read, analyze, and use in model pipelines

500

Name one practical use of image classification in real life.

Examples: Self-driving cars, medical scans, facial recognition, etc.