MAP REDUCE
Syed Zaid Irshad
15007114015
MS-SE
Scenario
■ City: Beijing, China
■ Population: 11.51 million
■ CCTV Cameras: 470,000 (24.5 person/camera)
■ EstimatedVideo generation:
– Frames per second: 30
– Video Length: 1 hour
– Storage: 6091.2TB.
■ Task: Find 20 peoples and their location
How to do this with single Camera
Face Detection
■ Training
– Integral Image
– AdaBoost
■ Real time Detection
– Cascade classifier
Face Detection
■ Find features
– Haar feature
■ Similar Properties
– The eyes region is darker than the upper-cheeks.
– The nose bridge region is brighter than the eyes.
■ Values
– FeatureValue = ∑ (pixels in black area) - ∑ (pixels in white area)
Integral Image
Face Detection
■ Problem
– Too many features (24x24 image contain 160000 features)
■ We have to select a subset of relevant features – which are informative - to model a
face
■ Constructs a “strong” classifier as a linear combination of weighted simple “weak”
classifiers
■ Experiments showed that a 200-feature classifier achieves: 95% detection rate
AdaBoost
Face Detection
■ Properties of Strong Classifier
– Number of layers in cascade (strong classifiers)
– Number of features of each strong classifier
– Threshold of each strong classifier
Cascade Classifier
Face Recognition
Geometric
■ Now the detected face image is preprocessed (resize)
■ Calculate distance between all points
– Euclidian distance
Face Recognition
Database Search
Found
Not Found
Face Feature
Assign an ID to results.
Scenario
■ City: Beijing, China
■ Population: 11.51 million
■ CCTV Cameras: 470,000
■ Estimated Video generation:
– Frames per second: 30
– Video Length: 1 hour
– Storage: 6091.2TB
■ Task: Find 20 peoples and their location
– 3.84MB/image
MapReduce
■ Scalability
■ Cost-effective solution
■ Flexibility
■ Fast
■ Parallel processing
■ Availability
MapReduce
■ Tasks to perform
– Face detect
– Face recognition
■ Feature extraction
■ Comparison
■ Input stream format: MJPEG-2
■ Assign each section of input stream (64MB) to a device and do operation
Mapper
■ It will receive the chunk of video.
■ Detect faces
■ Identify face-points
Class : Mapper
Function : Map
Map(TEXT key ( filename ) , BytesWritable value ( imgdata ) , FaceInfoString, ValueBuffer)
getImgBinaryData_From_Value;
convertBinaryData_To_JavaImage;
InitializeOpenCV_Via_JNI Interface;
runOpenCV_HaarLikeFaceDetector;
foreach ( DetectedFace )
createFaceBuffer_FaceSize;
createValueBuffer_Size30;
copyFacePixels_To_FaceBuffer ;
runGeometricBasedValues_To_ValueBuffer;
copyFaceValues_To_ValueBuffer;
create_FaceInfoString ;
//Output
set_key_FaceInfoString ;
set_value_ValueBuffer ;
end_foreach
Shuffler
■ On the bases of face-points it will send them to reducer
Reducer
■ Calculate distance from face-points.
■ Compare it with input face-points distance
Class : Reducer
Function : reduce
Reduce(TEXT key ( FaceInfoString ) , TEXT value ( ValueBuffer ) , FaceInfoString, DetectedFace)
for ( ValueBuffer )
createDifferenceBuffer_Size30;
runEculidean_To_Valuebuffer;
copyResults_To_DifferenceBuffer;
compareDifferenceBuffer_With_Database;
if (compareResultIsTrue)
copyImageFromDataBase_To_DetectedFace;
outputInformer :
set_key_FaceInfoString;
set_value_DetectedFace;
end_if
end_for
Map reduce
Map reduce

Map reduce

  • 1.
    MAP REDUCE Syed ZaidIrshad 15007114015 MS-SE
  • 2.
    Scenario ■ City: Beijing,China ■ Population: 11.51 million ■ CCTV Cameras: 470,000 (24.5 person/camera) ■ EstimatedVideo generation: – Frames per second: 30 – Video Length: 1 hour – Storage: 6091.2TB. ■ Task: Find 20 peoples and their location
  • 3.
    How to dothis with single Camera
  • 4.
    Face Detection ■ Training –Integral Image – AdaBoost ■ Real time Detection – Cascade classifier
  • 5.
    Face Detection ■ Findfeatures – Haar feature ■ Similar Properties – The eyes region is darker than the upper-cheeks. – The nose bridge region is brighter than the eyes. ■ Values – FeatureValue = ∑ (pixels in black area) - ∑ (pixels in white area) Integral Image
  • 6.
    Face Detection ■ Problem –Too many features (24x24 image contain 160000 features) ■ We have to select a subset of relevant features – which are informative - to model a face ■ Constructs a “strong” classifier as a linear combination of weighted simple “weak” classifiers ■ Experiments showed that a 200-feature classifier achieves: 95% detection rate AdaBoost
  • 7.
    Face Detection ■ Propertiesof Strong Classifier – Number of layers in cascade (strong classifiers) – Number of features of each strong classifier – Threshold of each strong classifier Cascade Classifier
  • 9.
    Face Recognition Geometric ■ Nowthe detected face image is preprocessed (resize) ■ Calculate distance between all points – Euclidian distance
  • 10.
    Face Recognition Database Search Found NotFound Face Feature Assign an ID to results.
  • 12.
    Scenario ■ City: Beijing,China ■ Population: 11.51 million ■ CCTV Cameras: 470,000 ■ Estimated Video generation: – Frames per second: 30 – Video Length: 1 hour – Storage: 6091.2TB ■ Task: Find 20 peoples and their location – 3.84MB/image
  • 13.
    MapReduce ■ Scalability ■ Cost-effectivesolution ■ Flexibility ■ Fast ■ Parallel processing ■ Availability
  • 14.
    MapReduce ■ Tasks toperform – Face detect – Face recognition ■ Feature extraction ■ Comparison
  • 15.
    ■ Input streamformat: MJPEG-2 ■ Assign each section of input stream (64MB) to a device and do operation
  • 16.
    Mapper ■ It willreceive the chunk of video. ■ Detect faces ■ Identify face-points
  • 17.
    Class : Mapper Function: Map Map(TEXT key ( filename ) , BytesWritable value ( imgdata ) , FaceInfoString, ValueBuffer) getImgBinaryData_From_Value; convertBinaryData_To_JavaImage; InitializeOpenCV_Via_JNI Interface; runOpenCV_HaarLikeFaceDetector; foreach ( DetectedFace ) createFaceBuffer_FaceSize; createValueBuffer_Size30; copyFacePixels_To_FaceBuffer ; runGeometricBasedValues_To_ValueBuffer; copyFaceValues_To_ValueBuffer; create_FaceInfoString ; //Output set_key_FaceInfoString ; set_value_ValueBuffer ; end_foreach
  • 18.
    Shuffler ■ On thebases of face-points it will send them to reducer
  • 19.
    Reducer ■ Calculate distancefrom face-points. ■ Compare it with input face-points distance
  • 20.
    Class : Reducer Function: reduce Reduce(TEXT key ( FaceInfoString ) , TEXT value ( ValueBuffer ) , FaceInfoString, DetectedFace) for ( ValueBuffer ) createDifferenceBuffer_Size30; runEculidean_To_Valuebuffer; copyResults_To_DifferenceBuffer; compareDifferenceBuffer_With_Database; if (compareResultIsTrue) copyImageFromDataBase_To_DetectedFace; outputInformer : set_key_FaceInfoString; set_value_DetectedFace; end_if end_for