# Background ML company product computer vision ## Assessment - Openbook - 2hrs (see how much you can get done) - document your process / thoughts - explain anything you didn't understand ## Problem - Images of bacteria - pixel, white - not bacteria, black is bacteria - 100,000 x 100,000 pixel - dye into bacteria, comes out as green - /> 10% dye coverage, bacteria has cancer - Compare two pictures ## Question to answer 1. What type of data structure to use 2. self testing the program. generating your own test images to pre vet your program before using production images. 3. Preformance ### Data Structure 0 - black 1 - white 2 - green - matrix pixel [[1 1 1] [0 0 0] [0 1 0]] - row by row, back and forth between images, only tracking percentage of cancer (black -> green) - store in a database - only store black pixel - - hash map - ### Considerations - no bacteria ### Assumptions / Scope documentation - pixel colors are solid (fully white, fully black etc) - large dataset, too large for memory - not implementing that, just stating what you are using - consideration (partial results) - ACID / Atomic - assuming no other colors - dye works intended outside of dye leakage - ### Algo ```go // Reading from datastore func readRow(start, end int, ds *dataStore) []int var ( totalBlack int nowGreen int ) // Optimizing for memory due to cost func compare(noDye, dye []int) { for i:= 0; i<length; i++ { noDyePixel := noDye[i] dyePixel := dye[i] if isBlack(noDyePixel) { totalBlack++ if isGreen(dyePixel) { nowGreen++ } } } } func main() { numRows := 1e10 / memoryLimit for numRows { noDye := readRow(start, end, noDyeDS) dye := readRow(start, end, dyeDS) compare(noDye, dye) } return nowGreen / totalBlack } ```