Comments (5)
@SurajDonthi where exactly is the output of the testing stored?
from multi-camera-person-re-identification.
@ankurguria you'll need 2 attributes as input:
- Image/Frame
- Timestamp formatted in either Market-1501 or Duke MTMC format.
You can create a Dataset from this.
# INPUTS
query_image: torch.Tensor()
query_cam_id: torch.Tensor()
query_frame: torch.Tensor()
class Dataset(...):
def __init__(self, ...):
...
self.gallery_images: torch.Tensor()
self.labels: torch.Tensor()
self.gallery_cam_ids: torch.Tensor()
self.gallery_frames: torch.Tensor()
...
def __getitem__(self, idx):
# Preprocessing
...
return processed_gallery_img[idx], self.gallery_cam_ids[idx], self.gallery_frames[idx]
dataset = Dataset(...)
dataloader(dataset, shuffle=False, ...)
To query on a single image against a gallery,
- You'll need to first compute the feature vectors
self(x, training=False)
of all gallery images (pass through CNN) & also collect their respectivecam_id
&frame
/timestamp
.
# Compute Feature Vector of Query Image
query_feature = self(query_image)
# Compute Feature Vector of all Gallery Images
gallery_features = torch.Tensor()
gallery_cam_ids = torch.Tensor()
gallery_frames = torch.Tensor()
for gallery_image, cam_id, frame in dataloader:
feature_sum = self(gallery_image, training=False)
flipped_image = fliplr(gallery_image)
feature_sum += self(flipped_image, training=False)
gallery_features = torch.cat([gallery_features, feature_sum])
gallery_cam_ids = torch.cat([gallery_cam_ids, cam_id])
gallery_frames = torch.cat([gallery_frames, frame])
- With these two attributes for both your query image & all the gallery images, you can calculate the
joint_scores()
given the Spatio-Temporal Distribution.
scores = joint_scores(
query_feature,
query_cam_id,
query_frame,
gallery_features,
gallery_cam_ids,
gallery_frames,
spatio_tempotal_distribution
)
# Optional
reranked_scores = re_ranking(scores)
- So the one with the highest joint score is the predicted gallery image/person_id.
gallery_image_idx = np.argmax(scores) # np.argmax(reranked_scores)
person_id = dataset.labels[gallery_image_idx]
Note: Functions to compute Spatio-Temporal Distribution(smooth_st_distribution
), Joint Score(joint_score
) & Re-ranking(re_ranking) are available in metrics.py
.
I hope this detailed explanation is helpful.
from multi-camera-person-re-identification.
@SurajDonthi where exactly is the output of the testing stored?
Currently, only the metrics are stored. However, feel free to create a pull request to add storing of the test outputs.
from multi-camera-person-re-identification.
@SurajDonthi thanks a lot for the detailed explanation. I understood the code.
I did try running this on Kaggle notebooks using the demo.ipynb. There are some output visualizations when I "commit and save it" on Kaggle. There must be some code already in the repo doing the visualization. But I wasn't able to find them. Could you please help me in pointing that chunk of code?
from multi-camera-person-re-identification.
@ankurguria, what you are looking for is engine.py
. The answer to all your questions lie in this file.
With regard to visualization, I think you're referring to the Spatio-Temporal Distribution. You can find it here:
.Please feel free to contribute any additional visualizations.
from multi-camera-person-re-identification.
Related Issues (15)
- Useable code HOT 1
- Error running Colab notebook - 5th block of code HOT 2
- Notebook doesn't work -> TypeError: validation_step() takes 3 positional arguments but 4 were given
- Unable to Reproduce: Training error HOT 1
- How to generate st_distribution.pkl?? HOT 2
- No module named 'metrics' HOT 1
- AttributeError: 'list' object has no attribute 'add_figure' HOT 2
- training error (training on Market-1501) HOT 3
- trained models HOT 2
- ModuleNotFoundError: No module named 'torchtext.legacy'
- Enhancing Model Robustness for Cross-Dataset Generalisation in Multi-Camera Person Re-Identification
- test issue
- Error in running mtmct_reid.train
- When i tried to run using colab: Error: 'Path 'data/raw/Market-1501-v15.09.15' does not exist! HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from multi-camera-person-re-identification.