stratascratch
  • Interview Questions
    • Interview Loops
    • Analytical
    • Algorithm
    • ML Coding
    • Stats Coding
    • Visualization
    • Concept
  • Data Labs
    • Discover
    • Your Notebooks
  • Mock Interview
  • Learn
  • Blog
  • Pricing
  • About
Log in
  • Interview Questions

    • Interview Loops
    • Analytical
    • Algorithm
    • ML Coding
    • Stats Coding
    • Visualization
    • Concept
  • Data Labs

    • Discover
    • Your Notebooks
  • Mock Interview
  • Learn
  • Blog
  • Pricing
  • About
Log inSign up
Back to Projects
  1. Assignment
  2. Your Solution
  3. Solutions from Users
  4. Discussion

Image Files Processing

You must be logged in to download the datasets

Amazon: Exploring image file metadata and pixel-level features to uncover patterns, insights, and key questions.

Assignment

1. Data frame

The purpose of the task is to test your ability to process image files and your knowledge of data-framing methods in a programming language of your choice. Based on the loaded photos, you need to create a data frame (e.g. Pandas DataFrame) with the following columns:

  • File name
  • Description of the photo content (the separator - should be replaced with a space)
  • Image ID
  • Width
  • Height
  • Average color
  • Median brightness after conversion to shades of gray
  • Horizontal coordinate of the brightest pixel after converting to grayscale*
  • Vertical coordinate of brightest pixel after converting to grayscale*

*The upper left corner of the image corresponds to the coordinates (0,0). If there are many brightest pixels, we choose the one closest according to the Euclidean norm to (0,0).

After creating the data frame, save it to images.csv file.

2. Aggregation of images

The second task is to sort the photos into subfolders. You need to sort the images by median brightness, divide them into bins of count 4, and save the images into subfolders with the naming scheme - [bin number]-images, numbering the bins from 1.

Data Description

Attached to the task is a directory images, which contains image files with the following file naming scheme - stock-photo-[image content description]-[image id].jpg. The images should be loaded into any programming environment in the RGB color model.

Practicalities

Make sure that the solution reflects your entire thought process - it is more important how the code is structured rather than the final files.

This question is part of an interview loop

See the full interview round by round, with questions for each stage.

Big Tech platforms · Analytics Engineer