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

Modify: supplement the kornia version of requirements.txt #24

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
199 changes: 199 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
unitr_pretrain.pth
logs/
output/

# Created by https://www.toptal.com/developers/gitignore/api/visualstudiocode,python
# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudiocode,python

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

### Python Patch ###
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
poetry.toml

# ruff
.ruff_cache/

# LSP config files
pyrightconfig.json

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide

# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,python
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ bash scripts/dist_train.sh 8 --cfg_file ./cfgs/nuscenes_models/unitr_map.yaml --

## add lss
cd tools
bash scripts/dist_train.sh 8 --cfg_file ./cfgs/nuscenes_models/unitr_map.yaml --sync_bn --eval_map --logger_iter_interval 1000
bash scripts/dist_train.sh 8 --cfg_file ./cfgs/nuscenes_models/unitr_map+lss.yaml --sync_bn --eval_map --logger_iter_interval 1000
```

### Testing
Expand Down
50 changes: 47 additions & 3 deletions pcdet/datasets/processor/data_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,15 @@ def mask_points_and_boxes_outside_range(self, data_dict=None, config=None):
mask = common_utils.mask_points_by_range(data_dict['points'], self.point_cloud_range)
data_dict['points'] = data_dict['points'][mask]

# 이전 프레임 포인트도 동일하게 처리
if 'prev_points' in data_dict:
prev_mask = common_utils.mask_points_by_range(data_dict['prev_points'], self.point_cloud_range)
data_dict['prev_points'] = data_dict['prev_points'][prev_mask]

if data_dict.get('gt_boxes', None) is not None and config.REMOVE_OUTSIDE_BOXES and self.training:
mask = box_utils.mask_boxes_outside_range_numpy(
data_dict['gt_boxes'], self.point_cloud_range, min_num_corners=config.get('min_num_corners', 1),
data_dict['gt_boxes'], self.point_cloud_range,
min_num_corners=config.get('min_num_corners', 1),
use_center_to_filter=config.get('USE_CENTER_TO_FILTER', True)
)
data_dict['gt_boxes'] = data_dict['gt_boxes'][mask]
Expand All @@ -100,8 +106,13 @@ def shuffle_points(self, data_dict=None, config=None):
if config.SHUFFLE_ENABLED[self.mode]:
points = data_dict['points']
shuffle_idx = np.random.permutation(points.shape[0])
points = points[shuffle_idx]
data_dict['points'] = points
data_dict['points'] = points[shuffle_idx]

# 이전 프레임 포인트도 동일하게 셔플
if 'prev_points' in data_dict:
prev_points = data_dict['prev_points']
prev_shuffle_idx = np.random.permutation(prev_points.shape[0])
data_dict['prev_points'] = prev_points[prev_shuffle_idx]

return data_dict

Expand Down Expand Up @@ -150,6 +161,12 @@ def transform_points_to_voxels(self, data_dict=None, config=None):
)

points = data_dict['points']

# 이전 프레임의 포인트 클라우드를 결합
if 'prev_points' in data_dict:
prev_points = data_dict['prev_points']
points = np.concatenate((prev_points, points), axis=0)

voxel_output = self.voxel_generator.generate(points)
voxels, coordinates, num_points = voxel_output

Expand Down Expand Up @@ -210,6 +227,33 @@ def sample_points(self, data_dict=None, config=None):
choice = np.concatenate((choice, extra_choice), axis=0)
np.random.shuffle(choice)
data_dict['points'] = points[choice]

# 이전 프레임 포인트에 대한 샘플링
if 'prev_points' in data_dict and len(data_dict['prev_points']) > 0:
prev_points = data_dict['prev_points']
if num_points < len(prev_points):
prev_pts_depth = np.linalg.norm(prev_points[:, 0:3], axis=1)
prev_pts_near_flag = prev_pts_depth < 40.0
prev_far_idxs_choice = np.where(prev_pts_near_flag == 0)[0]
prev_near_idxs = np.where(prev_pts_near_flag == 1)[0]
prev_choice = []
if num_points > len(prev_far_idxs_choice):
prev_near_idxs_choice = np.random.choice(prev_near_idxs,
num_points - len(prev_far_idxs_choice), replace=False)
prev_choice = np.concatenate((prev_near_idxs_choice, prev_far_idxs_choice), axis=0) \
if len(prev_far_idxs_choice) > 0 else prev_near_idxs_choice
else:
prev_choice = np.arange(0, len(prev_points), dtype=np.int32)
prev_choice = np.random.choice(prev_choice, num_points, replace=False)
np.random.shuffle(prev_choice)
else:
prev_choice = np.arange(0, len(prev_points), dtype=np.int32)
if num_points > len(prev_points):
prev_extra_choice = np.random.choice(prev_choice, num_points - len(prev_points), replace=False)
prev_choice = np.concatenate((prev_choice, prev_extra_choice), axis=0)
np.random.shuffle(prev_choice)
data_dict['prev_points'] = prev_points[prev_choice]

return data_dict

def calculate_grid_size(self, data_dict=None, config=None):
Expand Down
Loading