Spooky Sale: 10% off Premium yearly · $118.80 for the first year · until Nov 6Get it

Deep-ML
Learn
Problems1,200+ hands-on ML problemsLearning PathA guided route through the fundamentalsLabsInteractive labs on real techniquesProjectsBuild a GPT, an RL agent, CUDA kernelsCollectionsCurated problem sets and videosMathPen-and-paper math for MLIntuitionInvent the idea behind the formula yourselfPlaylistsYour own problem lists, shareableStudy AssistantAn AI teacher that knows your progress
Interview Prep
Compete
ContestsFresh problem sets, ranked liveLeaderboardWhere you stand, globallyBuddiesSolve with a friend: streaks, a weekly board, chat
Discuss
Deep-Path
Premium
      Intuition
      80 of 114

      Find the edges

      A photo is a grid of pixels, each a brightness. Write edge(patch): given one pixel and its 8 neighbours, a 3 × 3 grid with the pixel in the middle (patch[1][1]), say how strong the edge is there: how fast the brightness changes, per pixel.

      A night-sky photo, each pixel a brightness drawn as its grey. Walk across the moon and the brightness climbs, stays flat, then drops: the edges are where it changes, not where it’s brightest. The goal is an edge map like the one it ends on. Your edge(patch) sees one pixel and its 8 neighbours and says how strong the edge is there.

      A photo is a grid of brightness: 0 is the night sky, 15 the moon. Where are its edges?the photobrightness along row 7
      Your functionedge(patch)
      patchpatch[1][1] is the pixel, patch[0] the row above, patch[: , 0] the column to its lefte.g. [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
      returnshow strong the edge is at the pixel: how fast the brightness changes, per pixel
      solution.pyLoading Python
      Sign in for an AI hint
      ← How far can it see?Zoom in →