AI Preprocessing Difficulty โ Text, Image, Audio, Video, 3D in Order of Complexity
model(input) is one line, but the preprocessing to create that input is completely different per domain
All AI inference follows this structure:
processed_input = preprocess(raw_data) # โ differs by domain
output = model(processed_input) # โ always the same
result = postprocess(output) # โ differs by domain
model(input) just takes a PyTorch tensor and returns a tensor. The challenge is converting raw data into that tensor.
Level 1: Text โ Tokenization (โ โโโโ)
Easiest. Start here.
tokens = tokenizer("Hello world")["input_ids"]
# โ [15496, 995] โ lookup table, that's it
Why easy: 1D sequence, discrete integers, deterministic, tiny data.
Level 2: Tabular Data โ Normalize (โ โ โโโ)
features = (features - features.mean()) / features.std()
Already numbers. Just scale them.
Level 3: Image โ Resize + Normalize (โ โ โโโ)
preprocess = transforms.Compose([Resize(224), CenterCrop(224), ToTensor(), Normalize(...)])
tensor = preprocess(Image.open("cat.jpg")) # [3, 224, 224]
Why harder than text: continuous values, larger data, need normalization stats.
Level 4: Audio โ STFT + Mel (โ โ โ โ โ)
mel_spec = MelSpectrogram(sr=44100, n_fft=2048, n_mels=80)(wav)
log_mel = torch.log(mel_spec + 1e-9) # [80, time_frames]
Why hard: need Fourier transform understanding, model-specific hyperparameters, non-intuitive frequency domain.
Level 5: Video โ Frames + Temporal (โ โ โ โ โ)
frames = video[sampled_indices] # [16, 3, 224, 224]
Image preprocessing ร N frames + temporal dimension + sampling strategy.
Level 6: 3D / Point Clouds (โ โ โ โ โ )
points -= centroid; points /= max_dist # normalize
points = farthest_point_sampling(points, 1024) # [1024, 3]
Hardest: irregular data, order-invariant, coordinate alignment, immature ecosystem.
Study Order
- Text โ 2. Image โ 3. Audio โ 4. Video โ 5. 3D
Text has the shortest distance to model(input). That's why it's the best starting point.
Key Concepts
Text (โ โโโโ) โ tokenization is a lookup table. String โ integer array. Easiest
Image (โ โ โโโ) โ resize + normalize. Convert to [3, 224, 224] tensor
Audio (โ โ โ โ โ) โ STFT + mel filter bank + log scale. Requires Fourier transform understanding
Video (โ โ โ โ โ) โ frame sampling + image preprocessing ร N frames + temporal dimension
3D (โ โ โ โ โ ) โ point cloud normalization + FPS + coordinate alignment. Hardest