GithubHelp home page GithubHelp logo

Comments (3)

huanghoujing avatar huanghoujing commented on August 29, 2024 3

Thank you for your attention!

Least Modification for Your Usage

You can partition your data into trainval set and test set. Then, in your trainval set, you can separate some ids as val set. In this way, you have train, val, test sets.

For partitioning the test set or val set into query and gallery sets, you can use method partition_train_val_set in ./tri_loss/utils/dataset_utils.py.

If you don't want to rename your images as I do, you have to modify the parse_im_name method in ./tri_loss/utils/dataset_utils.py. Otherwise, you should rename your images to be with format new_im_name_tmpl = '{:08d}_{:04d}_{:08d}.jpg' (in ./tri_loss/utils/dataset_utils.py).

You have to save a dictionary with the following keys to a pickle file named partitions.pkl:

  • trainval_im_names, the list of trainval image names
  • trainval_ids2labels, a dictionary mapping trainval ids to labels
  • train_im_names, the list of train image names
  • train_ids2labels, a dictionary mapping train ids to labels
  • val_im_names, the list of val image names
  • val_marks, a list with the same length as val_im_names, containing 0 (denoting query image), 1 (denoting gallery image) or 2 (denoting multi-query image)
  • test_im_names, the list of test image names
  • test_marks, a list with the same length as test_im_names, containing 0 (denoting query image), 1 (denoting gallery image) or 2 (denoting multi-query image)

Usually, you wouldn't have multi-query set.

Place all images inside the same directory. Then add a new entry to tri_loss/dataset/__init__.py, as follows

elif name == YOUR-DATASET-NAME:
    im_dir = ospeu(YOUR-DATASET-IMAGE-DIRECTORY)
    partition_file = ospeu(YOUR-DATASET-PARTITION-PICKLE-FILE)

In the training script ./script/experiment/train.py, add your dataset name to this line, as follows

parser.add_argument('--dataset', type=str, default='market1501',
                        choices=['market1501', 'cuhk03', 'duke', 'combined', YOUR-DATASET-NAME])

Then the code should be running well on your dataset.

Compatibility with Provided Datasets

Since all datasets in tri_loss/dataset/__init__.py use the same parse_im_name method specified in ./tri_loss/utils/dataset_utils.py, you have to rename your image names to this format so that the code can run on all these datasets.

For renaming your image names to required format and moving all images to a directory, you can use method move_ims in tri_loss/utils/dataset_utils.py. Note that parse_im_name in def move_ims(ori_im_paths, new_im_dir, parse_im_name, new_im_name_tmpl) should be corresponding to your original image names.

For Extremely Large Dataset

If your dataset has extremely large number of images, e.g. hundreds of thousands, it may not be wise to place all images inside a single dataset, because retrieving an item from a directory containing e.g. millions of items may be time consuming. In this case, you can keep your original directory layout and provide relative image paths, e.g. sub-dir/image-name.jpg, to the code where image names are used. Some minor modification may also be needed in some places.

from person-reid-triplet-loss-baseline.

JJJackssson avatar JJJackssson commented on August 29, 2024

thank you very much for your timely help @huanghoujing

from person-reid-triplet-loss-baseline.

surajjunni avatar surajjunni commented on August 29, 2024

Actually I am a beginner in computer vision.I was going through your post.I could not understand how to use my own datasets for align re-id.Can you help me in this?

from person-reid-triplet-loss-baseline.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.