code: function () {
              if (!this._image instanceof IMSoftcrop.Image || !this._image.ready) {
                  return;
              }
  
              this._waitForWorkers++;
              var _this = this;
  
              if (window.Worker) {
                  // If workers are available, thread it
                  var featureWorker = new Worker(this._detectWorkerUrl);
  
                  featureWorker.postMessage([
                      'features',
                      this.getImageData(),
                      this._image.w,
                      this._image.h,
                      this._detectStepSize
                  ]);
  
                  featureWorker.onmessage = function(e) {
                      for(var n = 0; n < e.data.length; n++) {
                          _this.addDetectedFeature(e.data[n]);
                      }
                      _this._waitForWorkers--;
                      _this.autocropImages();
                  };
              }
              else {
                  //
                  // Add function to tracking.js in order to track corners directly
                  // on image data so that we do not need to access ui.
                  //
                  tracking.trackData = function(tracker, imageData, width, height) {
                      var task = new tracking.TrackerTask(tracker);
                      task.on('run', function() {
                          tracker.track(imageData.data, width, height);
                      });
                      return task.run();
                  };
  
                  var tracker = new tracking.ObjectTracker(['face']);
                  tracker.setStepSize(this._detectStepSize);
                  tracker.on('track', function (event) {
                      event.data.forEach(function (rect) {
                          _this.addDetectedFeature(rect);
                      });
                      _this._waitForWorkers--;
                      _this.autocropImages();
                  });
  
                  tracking.trackData(tracker, this.getImageData(), this._image.w, this._image.h);
              }
          }
docs: Detect faces in image