Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix reading of images with dots in the filename #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

carandraug
Copy link
Contributor

If an image has a dot in the filename, and the filename is listed on the groundtruth imlist without the file extension, then its filepath is incorrectly constructed without the file extension. The issue is in config_imname and `config_qimname):

function fname = config_imname (cfg, i)
%----------------------------------------------------
  [~, ~, ext] = fileparts(cfg.imlist{i});
  if isempty(ext)
    fname = sprintf ('%s/jpg/%s%s', cfg.dir_data, cfg.imlist{i}, cfg.ext);
  else
    fname = sprintf ('%s/jpg/%s', cfg.dir_data, cfg.imlist{i});
  end

If the filename in imlist has a dot and no file extension, for example Henry_Moore_Three_Way_Piece_No._2_0000, then fileparts returns _2_0000 as file extension, leading the code to construct the filepath without the file extension.

I don't think it's possible to use fileparts to decide on whether a string has or has not a file extension. fileparts is useful to split the filepath in its components but one needs to know a priori if we're dealing only with the basename or the filename.

There's two ways to fix this. Either we expect imlist to be the filename (with file extension) or the basename (without file extension). Since the groundtruth files provided by the project for oxford5k and paris6k do not include the file extension in imlist, I'm assuming that is preferred. This commit removes the logic that handles imlist and qimlist with the file extensions, thus making a requirement for groundtruth files to list the basename only.

…n filename.

It is not possible to use `fileparts` to find if a string includes the
file extension of a filename.  `fileparts` is only useful to split a
filepath in its components but we need to know ahead of time if there
is a file extension.  This is because the basename itself may have
dots.

This commit removes the logic that handles imlist and qimlist with the
file extensions.  It now always expects groundtruth imlist to be the
basename, i.e., without file extension.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant