diff --git a/.gitignore b/.gitignore index b5868d48..e6adec99 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,11 @@ +*.pyc +*.pth +.vscode +*.ckpt +*.onnx +*.pt +*.log +output .idea **__pycache__** -**.DS_Store** \ No newline at end of file +**.DS_Store** diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 00000000..dd0a08bb --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Xianda Guo + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index b1621440..62839184 100755 --- a/README.md +++ b/README.md @@ -76,4 +76,3 @@ Results and models are available in the [model zoo](docs/1.model_zoo.md). year={2024} } ``` -**Note**: This code is only used for academic purposes, people cannot use this code for anything that might be considered commercial use. diff --git a/cfgs/lightstereo/lightstereo_s_kitti.yaml b/cfgs/lightstereo/lightstereo_s_kitti.yaml index f0e958ca..0fb10b02 100644 --- a/cfgs/lightstereo/lightstereo_s_kitti.yaml +++ b/cfgs/lightstereo/lightstereo_s_kitti.yaml @@ -6,7 +6,7 @@ DATA_CONFIG: EVALUATING: '', TESTING: '' } - DATA_PATH: /yourpath/KITTI12 + DATA_PATH: /home/lihang.ying/data/KITTI/KITTI_2012 RETURN_RIGHT_DISP: true - DATASET: KittiDataset @@ -15,7 +15,7 @@ DATA_CONFIG: EVALUATING: ./data/KITTI15/kitti15_val20.txt, TESTING: ./data/KITTI15/kitti15_test.txt } - DATA_PATH: /yourpath/KITTI5 + DATA_PATH: /home/lihang.ying/data/KITTI/KITTI_2015 RETURN_RIGHT_DISP: true DATA_TRANSFORM: diff --git a/deploy/export.py b/deploy/export.py index cb4dbe9a..f7aa20d5 100644 --- a/deploy/export.py +++ b/deploy/export.py @@ -38,7 +38,7 @@ # Network sys.path.append(str(ROOT.parent)) # add ROOT to PATH -from stereo.modeling import models, build_trainer +# from stereo.modeling import models, build_trainer from stereo.utils.common_utils import config_loader, create_logger, load_params_from_file from stereo.modeling.models.sttr.sttr import STTR @@ -54,6 +54,7 @@ from stereo.modeling.models.casnet.cas_gwc import GwcNet as CasGwcNet from stereo.modeling.models.casnet.cas_psm import PSMNet as CasPSMNet from stereo.modeling.models.lightstereo.lightstereo import LightStereo as LightStereo +from stereo.modeling.models.stereobase.stereobase_gru import StereoBase as StereoBaseGRU __net__ = { @@ -69,6 +70,7 @@ 'CFNet': CFNet, 'CasGwcNet': CasGwcNet, 'CasPSMNet': CasPSMNet, + 'StereoBaseGRU': StereoBaseGRU, 'LightStereo': LightStereo } @@ -295,7 +297,7 @@ def run( int8=False, # CoreML INT8 quantization dynamic=False, # ONNX/TensorRT: dynamic axes simplify=True, # ONNX: simplify model - opset=12, # ONNX: opset version + opset=17, # ONNX: opset version verbose=False, # TensorRT: verbose log workspace=4, # TensorRT: workspace size (GB) ): @@ -403,7 +405,7 @@ def parse_opt(): parser.add_argument('--int8', action='store_true', help='CoreML INT8 quantization') parser.add_argument('--dynamic', action='store_true', help='ONNX/TensorRT: dynamic axes') parser.add_argument('--simplify', action='store_true', help='ONNX: simplify model') - parser.add_argument('--opset', type=int, default=12, help='ONNX: opset version') + parser.add_argument('--opset', type=int, default=17, help='ONNX: opset version') parser.add_argument('--verbose', action='store_true', help='TensorRT: verbose log'), parser.add_argument('--workspace', type=int, default=4, help='TensorRT: workspace size (GB)') parser.add_argument( diff --git a/requirements.txt b/requirements.txt index 89b0738f..d81a2654 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,4 +7,8 @@ opencv-python timm==0.4.12 scikit-image thop -matplotlib \ No newline at end of file +matplotlib +h5py +antialiased_cnns +kornia +onnx \ No newline at end of file diff --git a/stereo/modeling/__init__.py b/stereo/modeling/__init__.py index 6a3cda56..90e25fc0 100644 --- a/stereo/modeling/__init__.py +++ b/stereo/modeling/__init__.py @@ -32,8 +32,8 @@ 'CasPSMNet': CasStereoTrainer, 'LightStereo': LightStereoTrainer, 'StereoBaseGRU': StereoBaseGRUTrainer, - # 'IInet': IINetTrainer, - 'NMRF': NMRFTrainer + 'IInet': IINetTrainer, + 'NMRF': NMRFTrainer, } diff --git a/tools/train.py b/tools/train.py index fa730dd8..3b36229a 100644 --- a/tools/train.py +++ b/tools/train.py @@ -47,7 +47,7 @@ def parse_config(): dataset_name = each.DATASET if dataset_name == 'KittiDataset': dataset_name = 'KittiDataset15' if 'kitti15' in each.DATA_SPLIT.EVALUATING else 'KittiDataset12' - each.DATA_PATH = DATA_PATH_DICT[dataset_name] + each.DATA_PATH = each['DATA_PATH'] args.run_mode = 'train' return args, cfgs @@ -74,7 +74,11 @@ def main(): # savedir args.output_dir = str(os.path.join(args.save_root_dir, args.exp_group_path, args.tag, args.extra_tag)) if os.path.exists(args.output_dir) and args.extra_tag != 'debug' and cfgs.MODEL.CKPT == -1: - raise Exception('There is already an exp with this name') + current_time = datetime.now() + formatted_time = current_time.strftime("%Y-%m-%d_%H%M%S") + + args.extra_tag = f'{args.extra_tag}_{formatted_time}' + # raise Exception('There is already an exp with this name') if args.dist_mode: dist.barrier() args.ckpt_dir = os.path.join(args.output_dir, 'ckpt')