Exemple #1
0
    def detect_selective_search(self, image_fnames):
        """
        Do windowed detection over Selective Search proposals by extracting
        the crop and warping to the input dimensions of the net.

        Take
        image_fnames: list

        Give
        detections: list of {filename: image filename, window: crop coordinates,
            predictions: prediction vector} dicts.
        """
        # Make sure that 'selective_search_ijcv_with_python' is on the python path:
        search_root = '/Users/chickenchen/githubrepo/'  # this file is expected to be in {caffe_root}/examples
        import sys
        sys.path.insert(0, search_root)
        import selective_search_ijcv_with_python as selective_search
        # Make absolute paths so MATLAB can find the files.
        image_fnames = [os.path.abspath(f) for f in image_fnames]
        windows_list = selective_search.get_windows(
            image_fnames,
            cmd='selective_search_rcnn'
        )
        # Run windowed detection on the selective search list.
        return self.detect_windows(zip(image_fnames, windows_list))
Exemple #2
0
def _assemble_images_selective_search(image_fnames):
  """
  Run Selective Search window proposals on all images, then for each
  image-window pair, extract a square crop.

  Input:
    image_fnames: list

  Output:
    images_df: pandas.DataFrame
      With 'image', 'window', 'filename' columns.
  """
  windows_list = selective_search.get_windows(image_fnames)

  data = []
  for image_fname, windows in zip(image_fnames, windows_list):
    image = load_image(image_fname)
    for window in windows:
      window_image, _ = format_image(image, window, cropped_size=True)
      data.append({
        'image': window_image[np.newaxis, :],
        'window': window,
        'filename': image_fname
      })

  images_df = pd.DataFrame(data)
  return images_df
def _assemble_images_selective_search(image_fnames, n_max=-1):
    """
  Run Selective Search window proposals on all images, then for each
  image-window pair, extract a square crop.

  Input:
    image_fnames: list
    n_max: max number of boxes to mine, -1 means no restriction

  Output:
    images_df: pandas.DataFrame
      With 'image', 'window', 'filename' columns.
  """
    windows_list = selective_search.get_windows(image_fnames, n_max)
    data = []
    nWindows = 0.
    for image_fname, windows in zip(image_fnames, windows_list):
        image = load_image(image_fname)
        print "{}: {:d} windows found".format(image_fname, windows.shape[0])
        nWindows += windows.shape[0]
        for window in windows:
            window_image, _ = format_image(image, window, cropped_size=True)
            data.append({
                'image': window_image[np.newaxis, :],
                'window': window,
                'filename': image_fname
            })

    nImgs = len(image_fnames)
    print "mean number of windows found for {:d} images : {:.3f}".format(
        nImgs, nWindows / nImgs)
    images_df = pd.DataFrame(data)
    return images_df
Exemple #4
0
def _assemble_images_selective_search(image_fnames):
  """
  Run Selective Search window proposals on all images, then for each
  image-window pair, extract a square crop.

  Input:
    image_fnames: list

  Output:
    images_df: pandas.DataFrame
      With 'image', 'window', 'filename' columns.
  """
  windows_list = selective_search.get_windows(image_fnames)

  data = []
  for image_fname, windows in zip(image_fnames, windows_list):
    image = load_image(image_fname)
    for window in windows:
      window_image, _ = format_image(image, window, cropped_size=True)
      data.append({
        'image': window_image[np.newaxis, :],
        'window': window,
        'filename': image_fname
      })

  images_df = pd.DataFrame(data)
  return images_df
def _assemble_images_selective_search(image_fnames):
    """
  Run Selective Search window proposals on all images, then for each
  image-window pair, extract a square crop.

  Input:
    image_fnames: list

  Output:
    images_df: pandas.DataFrame
      With 'image', 'filename' columns.
  """
    windows_list = selective_search.get_windows(image_fnames)

    data = []
    for image_fname, windows in zip(image_fnames, windows_list):
        image = load_image(image_fname)
        for window in windows:
            data.append(
                {
                    "image": format_image(image, window, CROPPED_DIM)[np.newaxis, :],
                    "window": window,
                    "filename": image_fname,
                }
            )

    images_df = pd.DataFrame(data)
    return images_df
Exemple #6
0
def _assemble_images_selective_search(image_fnames, n_max=-1):
  """
  Run Selective Search window proposals on all images, then for each
  image-window pair, extract a square crop.

  Input:
    image_fnames: list
    n_max: max number of boxes to mine, -1 means no restriction

  Output:
    images_df: pandas.DataFrame
      With 'image', 'window', 'filename' columns.
  """
  windows_list = selective_search.get_windows(image_fnames, n_max)
  data = []
  nWindows = 0.
  for image_fname, windows in zip(image_fnames, windows_list):
    image = load_image(image_fname)
    print "{}: {:d} windows found".format(image_fname, windows.shape[0])
    nWindows += windows.shape[0]
    for window in windows:
      window_image, _ = format_image(image, window, cropped_size=True)
      data.append({
        'image': window_image[np.newaxis, :],
        'window': window,
        'filename': image_fname
      })
      
  nImgs = len(image_fnames)    
  print "mean number of windows found for {:d} images : {:.3f}".format(nImgs, nWindows/nImgs)
  images_df = pd.DataFrame(data)
  return images_df
Exemple #7
0
 def detect_selective_search(self, image_fnames):
     """Do windowed detection over Selective Search proposals by extracting the crop and warping to the input dimensions of the net.
     Parameters
         image_fnames: list
     Returns
         detections: list of {filename: image filename, window: crop coordinates, predictions: prediction vector} dicts."""       
     # Make absolute paths so MATLAB can find the files.
     image_fnames = [os.path.abspath(f) for f in image_fnames]
     windows_list = selective_search.get_windows(image_fnames, cmd='selective_search_rcnn')
     # Run windowed detection on the selective search list.
     return self.detect_windows(zip(image_fnames, windows_list))
Exemple #8
0
    def detect_selective_search(self, image_fnames):
        """
        Do windowed detection over Selective Search proposals by extracting
        the crop and warping to the input dimensions of the net.

        Take
        image_fnames: list

        Give
        detections: list of {filename: image filename, window: crop coordinates,
            predictions: prediction vector} dicts.
        """
        import selective_search_ijcv_with_python as selective_search
        # Make absolute paths so MATLAB can find the files.
        image_fnames = [os.path.abspath(f) for f in image_fnames]
        windows_list = selective_search.get_windows(image_fnames)
        # Run windowed detection on the selective search list.
        return self.detect_windows(zip(image_fnames, windows_list))
Exemple #9
0
    def detect_selective_search(self, image_fnames):
        """
        Do windowed detection over Selective Search proposals by extracting
        the crop and warping to the input dimensions of the net.

        Take
        image_fnames: list

        Give
        detections: list of {filename: image filename, window: crop coordinates,
            predictions: prediction vector} dicts.
        """
        print ">>>>>>>>>>>>>>>> Detector detect_selective_search"
        import selective_search_ijcv_with_python as selective_search
        # Make absolute paths so MATLAB can find the files.
        image_fnames = [os.path.abspath(f) for f in image_fnames]
        windows_list = selective_search.get_windows(image_fnames)
        # Run windowed detection on the selective search list.
        return self.detect_windows(zip(image_fnames, windows_list))
def getProposal(imageName):
    obj_proposals = selective_search.get_windows({imageName})
    return obj_proposals