Git Product home page Git Product logo

discovery_obj_move's Introduction

Discovering Object that Can Move

This is the repository for Discovering Object that Can Move, published at CVPR 2022.

[Project Page] [Paper] [Poster]

Update blogs

[July 2023]: [PD_bounding boxes]

  1. Added 2D and 3D bounding boxes. The annotation format and labels are demonstrated in the readme.txt file.

[April 2023]: [PD_full]

  1. Added depth and semantic masks.
  2. Check our new work: Object Discovery from Motion-Guided Tokens; [code]

[Jan 2023]: [Simplified dataset and Additional data]

  1. Change the download folder from box to google drive, which is easier to download.
  2. Simplified TRI-PD (rgb, flow, and Ground-truth and estimated instance masks) dataset provided.
  3. KITTI estimated masks and test data included.
  4. Pre-trained models provided.
  5. There are some problems with the raw data links currently, the simplified version is the correct one.

To download the files in google drive from a server, please check gdown. Some sample code to download the files in the folder:

import gdown
url = "https://drive.google.com/drive/folders/1q5AjqhoivJb67h9MZCgUtqb4CooDrZhC"

gdown.download_folder(url, quiet = False, use_cookies = False)

Set up

Python 3 dependencies:

  • torch 1.7.1+CUDA11.0
  • matplotlib
  • cv2
  • numpy
  • scipy
  • tqmd

The default training scipt takes ~15GB*4 for training

Running code

pre-processing

To run the model on the TRI-PD dataset, first download PD data and annotations and unzip the tar files. Then run the commend

python merge_pd.py --pd_dir /A/B --additional_dir /C/D

The full dataset will be merged to the path /A/B

The full dataset should be at the following structure:

root 
   - scene_000001
      - rgb
         - camera_01
            - 000000000000000005.png
            - ...
         - camera_04
         - camera_05
         - camera_06
         - camera_07
         - camera_08
         - camera_09
      - motion_vectors_2d
      - back_motion_vectors_2d
      - moving_masks
      - ari_masks
      - est_masks
   - scene_000003
   - ...

Train the model

python trianPD.py and python trainKITTI.py

See trainPD.sh and trainKITTI.sh for a sample training script

Evaluating the pre-trained model

To evaluate or infer on the test set, first download the pre-trained model (or train it with the training code), then run

python eval.py

to compute the FG.ARI score. We revised the code and fixed some bugs. The ARI score may be slightly different from the reported results in the main paper. See eval.sh for a sample evaluating script.

Visualize the slot masks

To infer and visualize on a video of arbitary length, see

PlotPD.py

for a sample code.

Pre-trained models

Pre-trained models are located in the pre-trained models folder in this drive.

TRI-PD Dataset

PD datasets:

Simplified dataset, full version of the dataset, and Additional annotations (moving object masks; dynamic object masks), test data, and pre-trained model: [Additional data]

Raw PD dataset (including RGB, semantic segmentation, instance segmentation, optical flow, depth, camera colibrations, 2D/3D bounding boxes, etc. ) is connected to TRI's Vidar project. Leave a message in the issues or contact [email protected] for the annotations other than the provided ones.

Sample code to transfer the motion vectors to flow xy:

rgba = cv2.imread('x.png',-1)
r,g,b,a = rgba[:,:,0], rgba[:,:,1], rgba[:,:,2], rgba[:,:,3]
h,w,_ = flow.shape
dx_i = r+g*256
dy_i = b+a*256
flow_x = ((dx_i / 65535.0)*2.0-1.0) * w
flow_y = ((dy_i / 65535.0)*2.0 - 1.0) * h            

Acknowledgement

The slot attention modules is referred to the pytorch slot attention and the official google repo, the estimated motion segments are generated by Towards segmenting anything that moves repo.

Citation

@inproceedings{bao2022discovering,
    Author = {Bao, Zhipeng and Tokmakov, Pavel and Jabri, Allan and Wang, Yu-Xiong and Gaidon, Adrien and Hebert, Martial},
    Title = {Discorying Object that Can Move},
    Booktitle = {CVPR},
    Year = {2022},
}

discovery_obj_move's People

Contributors

zpbao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

hankkung

discovery_obj_move's Issues

Training Time & Pretrained model

Hi Zhipeng,

thanks again for providing the data and the code!
I just wondered whether you could give me any info on how much GPU RAM you needed for training and how long it takes to train the model from scratch.

Many thanks in advance :D.
Best,
Felix

TRI-PD splits

Hello Zhipeng,

I would like to split the TRI-PD dataset in the same way as you but cannot find detailed information.

In the paper you mention that 924 videos are used for training and 51 videos for evaluation. From the code (datasetPD.py) it however seems that some scenes are ignored, a single scene is used for evaluation and the rest for training.

Am I missing something? Could you please clarify which videos have been used for training and evaluation?

Thank you,
Matthias

Model parameters for CATER dataset

Dear Zhipeng,

Thank you for your outstanding work and this open-source code. I noticed that only the model and configuration files for TRI-PD are provided in your open-source code. Could you provide the model parameters for the CATER dataset to help us understand the setup better? Thanks in advance!

Best,
Lei

The details about loss?

Hello! I am very interested in this job, which is the first to be able to make the slot attention work on video. In our attempt to implement DOM, we face some problems. In the paper, the authors add all the MSE and cross-entropy loss together. However, it seems such a strategy will make the training unstable. Could you please tell us how you calculate the loss? Did you take the average among the time or add them together along the batch or time dimension? And should we take the average on the spatial dimension when calculating MSE and cross-entropy loss? What's more, it seems the paper did not specify what matrix norm in the slot consistency. I take the sum of absolute number, is it okay?

Truncated archives (TRI-PD dataset)

Dear Zhipeng,

Thank you for making the TRI-PD dataset available! I have however problems with using the data: archives 14-19 are truncated (tar: Unexpected EOF in archive). I tried downloading the files again but got the same error.

Can you double check whether the data was uploaded correctly? Maybe you could also publish checksums of your local files so that the download can be verified.

Thank you,
Matthias

Evaluation code

When are you planning to release the evaluation code? Hopefully some weeks before CVPR deadline 🤞

About pretrained models?

Thanks for your great work, and I want to when you will release your pretrained model. Thanks in advance!

Missing additional data?

Thank you for sharing code of your nice work!
I am trying to train with the TRI-PD dataset, but I cannot find "additional annotations" from the link on the readme.
I understand the annotations are not necessary for the training itself, but can you please check if the annotations are available?
Thank you!

really unsupervise?

In the paper, you used the segmentation masks to supervise, so why it is called unsupervised method??

Faster segmentation processing in dataloader

Hi,

I was playing around with the code a little and noticed that the processing of the segmentation mask in the dataloader is fairly slow. (Line 73 - 82 in dataset.py). I quickly threw together a version of this which is much faster. I propose to replace

count = 0
for i in range(mask.shape[0]):
    for j in range(mask.shape[1]):
        if mask[i,j] not in mapping:
            if mask[mask == mask[i,j]].sum()>50:
                mapping[mask[i,j]] = count
                count += 1
            else:
                mapping[mask[i,j]] = 0
        mask[i,j] = mapping[mask[i,j]]

with

values, indices, counts = np.unique(mask, return_inverse=True, return_counts=True)
to_eliminate = counts <= 50
mapping = np.arange(len(values))
mapping[to_eliminate] = 0
_h, _w = mask.shape
mask = mapping[indices].reshape((_h, _w))

On my machine, this sections gets speed up from ~0.3s to 0.01s.

Best,
Felix

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.