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

IndexError: too many indices for array: array is 2-dimensional, but 21 were indexed #46

Open
LDS666888 opened this issue Apr 12, 2024 · 2 comments

Comments

@LDS666888
Copy link

LDS666888 commented Apr 12, 2024

When I ran the demo, the following error occurred:
Traceback (most recent call last):
File "./tools/test_images.py", line 122, in
dataset = get_dataset(args.dataset_name)
File "/home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/factory.py", line 57, in get_dataset
return __setsname
File "/home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/factory.py", line 28, in
datasets.YCBObject(split))
File "/home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/ycb_object.py", line 75, in init
self._extents = self._extents_all[cfg.TRAIN.CLASSES]
IndexError: too many indices for array: array is 2-dimensional, but 21 were indexed

The following is the complete part:
(pose) ys@ys-System-Product-Name:~/PoseCNN-PyTorch-main$ ./experiments/scripts/demo.sh

  • set -e
  • export PYTHONUNBUFFERED=True
  • PYTHONUNBUFFERED=True
  • export CUDA_VISIBLE_DEVICES=0
  • CUDA_VISIBLE_DEVICES=0
  • ./tools/test_images.py --gpu 0 --imgdir data/demo/ --meta data/demo/meta.yml --color '*color.png' --network posecnn --pretrained data/checkpoints/ycb_object/vgg16_ycb_object_self_supervision_epoch_8.checkpoint.pth --dataset ycb_object_test --cfg experiments/cfgs/ycb_object.yml
    ycb_video_train
    ycb_video_val
    ycb_video_keyframe
    ycb_video_trainval
    ycb_video_debug
    ycb_object_train
    ycb_object_test
    ycb_self_supervision_train_1
    ycb_self_supervision_train_2
    ycb_self_supervision_train_3
    ycb_self_supervision_train_4
    ycb_self_supervision_train_5
    ycb_self_supervision_test
    ycb_self_supervision_all
    ycb_self_supervision_train_block_median
    ycb_self_supervision_train_block_median_azure
    ycb_self_supervision_train_block_median_demo
    ycb_self_supervision_train_block_median_azure_demo
    ycb_self_supervision_train_table
    ycb_self_supervision_debug
    ycb_self_supervision_train_block
    ycb_self_supervision_train_block_azure
    ycb_self_supervision_train_block_big_sim
    ycb_self_supervision_train_block_median_sim
    ycb_self_supervision_train_block_small_sim
    background_coco
    background_rgbd
    background_nvidia
    background_table
    background_isaac
    background_texture
    Called with args:
    Namespace(background_name=None, cfg_file='experiments/cfgs/ycb_object.yml', codebook=None, color_name='*color.png', dataset_name='ycb_object_test', depth_name='*depth.png', gpu_id=0, imgdir='data/demo/', meta_file='data/demo/meta.yml', network_name='posecnn', pretrained='data/checkpoints/ycb_object/vgg16_ycb_object_self_supervision_epoch_8.checkpoint.pth', pretrained_encoder=None, randomize=False)
    {'INTRINSICS': [618.0172729492188, 0.0, 312.376953125, 0.0, 618.0033569335938, 232.37530517578125, 0.0, 0.0, 1.0]}
    Using config:
    {'ANCHOR_RATIOS': (0.5, 1, 2),
    'ANCHOR_SCALES': (8, 16, 32),
    'BACKGROUND': '',
    'CAD': '',
    'DATA_PATH': '',
    'EPS': 1e-14,
    'EXP_DIR': 'ycb_object',
    'FEATURE_STRIDE': 16,
    'FLIP_X': False,
    'FLOW_HEIGHT': 512,
    'FLOW_WIDTH': 640,
    'GPU_ID': 0,
    'INPUT': 'COLOR',
    'INTRINSICS': [618.0172729492188,
    0.0,
    312.376953125,
    0.0,
    618.0033569335938,
    232.37530517578125,
    0.0,
    0.0,
    1.0],
    'MODE': 'TRAIN',
    'NETWORK': 'VGG16',
    'PIXEL_MEANS': array([[[102.9801, 115.9465, 122.7717]]]),
    'POSE': '',
    'RIG': '',
    'RNG_SEED': 3,
    'ROOT_DIR': '/home/ys/PoseCNN-PyTorch-main',
    'TEST': {'ALIGN_Z_AXIS': False,
    'BBOX_REG': True,
    'BUILD_CODEBOOK': False,
    'CHECK_SIZE': False,
    'CLASSES': (0,
    1,
    2,
    3,
    4,
    5,
    6,
    7,
    8,
    9,
    10,
    11,
    12,
    13,
    14,
    15,
    16,
    17,
    18,
    20,
    21),
    'DET_THRESHOLD': 0.2,
    'GAN': False,
    'GEN_DATA': False,
    'GLOBAL_SEARCH': False,
    'GRID_SIZE': 256,
    'HOUGH_INLIER_THRESHOLD': 0.9,
    'HOUGH_LABEL_THRESHOLD': 400,
    'HOUGH_SKIP_PIXELS': 10,
    'HOUGH_VOTING_THRESHOLD': 10,
    'IMS_PER_BATCH': 1,
    'ITERNUM': 4,
    'MEAN_SHIFT': False,
    'NMS': 0.3,
    'NUM_LOST': 3,
    'NUM_SDF_ITERATIONS_INIT': 100,
    'NUM_SDF_ITERATIONS_TRACKING': 50,
    'POSE_CODEBOOK': False,
    'POSE_REFINE': True,
    'POSE_REG': False,
    'POSE_SDF': True,
    'RANSAC': False,
    'ROS_CAMERA': 'D435',
    'RPN_NMS_THRESH': 0.7,
    'RPN_POST_NMS_TOP_N': 300,
    'RPN_PRE_NMS_TOP_N': 6000,
    'SCALES_BASE': (1.0,),
    'SDF_ROTATION_REG': 10.0,
    'SDF_TRANSLATION_REG': 1000.0,
    'SEGMENTATION': True,
    'SINGLE_FRAME': True,
    'SYMMETRY': (0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    1,
    0,
    0,
    0,
    1),
    'SYNTHESIZE': True,
    'VERTEX_REG_2D': False,
    'VERTEX_REG_3D': False,
    'VISUALIZE': True},
    'TRAIN': {'ADAPT': False,
    'ADAPT_NUM': 400,
    'ADAPT_RATIO': 1,
    'ADAPT_ROOT': '',
    'ADAPT_WEIGHT': 0.1,
    'ADD_NOISE': True,
    'AFFINE': False,
    'BATCH_SIZE': 128,
    'BBOX_INSIDE_WEIGHTS': (1.0, 1.0, 1.0, 1.0),
    'BBOX_NORMALIZE_MEANS': (0.0, 0.0, 0.0, 0.0),
    'BBOX_NORMALIZE_STDS': (0.1, 0.1, 0.2, 0.2),
    'BBOX_NORMALIZE_TARGETS': True,
    'BBOX_NORMALIZE_TARGETS_PRECOMPUTED': True,
    'BETA': 0.999,
    'BG_THRESH_HI': 0.5,
    'BG_THRESH_LO': 0.1,
    'BOOSTRAP_PIXELS': 20,
    'BOX_W': 1.0,
    'CHROMATIC': True,
    'CLASSES': (0,
    1,
    2,
    3,
    4,
    5,
    6,
    7,
    8,
    9,
    10,
    11,
    12,
    13,
    14,
    15,
    16,
    17,
    18,
    20,
    21),
    'DISPLAY': 20,
    'FG_FRACTION': 0.25,
    'FG_THRESH': 0.5,
    'FG_THRESH_POSE': 0.5,
    'FREEZE_LAYERS': True,
    'GAMMA': 0.1,
    'GAN': False,
    'GPUNUM': 1,
    'GRID_SIZE': 256,
    'HARD_ANGLE': 5.0,
    'HARD_LABEL_SAMPLING': 0.0,
    'HARD_LABEL_THRESHOLD': 0.9,
    'HAS_RPN': True,
    'HEATUP': 4,
    'HOUGH_INLIER_THRESHOLD': 0.9,
    'HOUGH_LABEL_THRESHOLD': 100,
    'HOUGH_SKIP_PIXELS': 10,
    'HOUGH_VOTING_THRESHOLD': 10,
    'IMS_PER_BATCH': 2,
    'ITERNUM': 4,
    'ITERS': 0,
    'LABEL_W': 1.0,
    'LEARNING_RATE': 0.001,
    'MATCHING': False,
    'MAX_ITERS_PER_EPOCH': 1000000,
    'MILESTONES': (3,),
    'MOMENTUM': 0.9,
    'NOISE_LEVEL': 0.05,
    'NUM_STEPS': 5,
    'NUM_UNITS': 64,
    'OPTIMIZER': 'MOMENTUM',
    'POSE_REG': True,
    'POSE_W': 1.0,
    'RPN_BATCHSIZE': 256,
    'RPN_BBOX_INSIDE_WEIGHTS': (1.0, 1.0, 1.0, 1.0),
    'RPN_CLOBBER_POSITIVES': False,
    'RPN_FG_FRACTION': 0.5,
    'RPN_NEGATIVE_OVERLAP': 0.3,
    'RPN_NMS_THRESH': 0.7,
    'RPN_POSITIVE_OVERLAP': 0.7,
    'RPN_POSITIVE_WEIGHT': -1.0,
    'RPN_POST_NMS_TOP_N': 2000,
    'RPN_PRE_NMS_TOP_N': 12000,
    'SCALES_BASE': (1.0,),
    'SEGMENTATION': True,
    'SINGLE_FRAME': False,
    'SLIM': False,
    'SNAPSHOT_EPOCHS': 1,
    'SNAPSHOT_INFIX': 'ycb_object',
    'SNAPSHOT_PREFIX': 'vgg16',
    'SYMMETRY': (0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    1,
    0,
    0,
    0,
    1),
    'SYMSIZE': 0,
    'SYNITER': 0,
    'SYNNUM': 40000,
    'SYNROOT': '/home/yuxiang/Projects/Deep_Pose/data/LOV/data_syn/',
    'SYNTHESIZE': True,
    'SYN_BACKGROUND_AFFINE': False,
    'SYN_BACKGROUND_CONSTANT_PROB': 0.1,
    'SYN_BACKGROUND_SPECIFIC': True,
    'SYN_BACKGROUND_SUBTRACT_MEAN': True,
    'SYN_BOUND': 0.3,
    'SYN_CLASS_INDEX': 1,
    'SYN_CROP': False,
    'SYN_CROP_SIZE': 224,
    'SYN_HEIGHT': 480,
    'SYN_MAX_OBJECT': 8,
    'SYN_MIN_OBJECT': 5,
    'SYN_ONLINE': False,
    'SYN_RATIO': 5,
    'SYN_SAMPLE_DISTRACTOR': True,
    'SYN_SAMPLE_OBJECT': True,
    'SYN_SAMPLE_POSE': False,
    'SYN_STD_ROTATION': 15,
    'SYN_STD_TRANSLATION': 0.05,
    'SYN_TABLE_PROB': 0.8,
    'SYN_TFAR': 1.6,
    'SYN_TNEAR': 0.5,
    'SYN_WIDTH': 640,
    'TRAINABLE': True,
    'UNIFORM_POSE_INTERVAL': 15,
    'USE_FLIPPED': False,
    'USE_GT': False,
    'VERTEX_REG': True,
    'VERTEX_REG_DELTA': False,
    'VERTEX_W': 1.0,
    'VERTEX_W_INSIDE': 10.0,
    'VISUALIZE': False,
    'WEIGHT_DECAY': 0.0001},
    'USE_GPU_NMS': True,
    'gpu_id': 0,
    'instance_id': 0}
    GPU device 0
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/002_master_chef_can/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/003_cracker_box/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/004_sugar_box/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/005_tomato_soup_can/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/006_mustard_bottle/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/007_tuna_fish_can/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/008_pudding_box/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/009_gelatin_box/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/010_potted_meat_can/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/011_banana/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/019_pitcher_base/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/021_bleach_cleanser/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/024_bowl/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/025_mug/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/035_power_drill/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/036_wood_block/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/037_scissors/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/040_large_marker/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/051_large_clamp/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/052_extra_large_clamp/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/061_foam_brick/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/holiday_cup1/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/holiday_cup2/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/sanning_mug/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/001_chips_can/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/block_red_big/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/block_green_big/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/block_blue_big/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/block_yellow_big/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/block_red_small/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/block_green_small/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/block_blue_small/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/block_yellow_small/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/block_red_median/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/block_green_median/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/block_blue_median/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/block_yellow_median/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/fusion_duplo_dude/points.xyz
    /home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/../../data/models/cabinet_handle/points.xyz
    Traceback (most recent call last):
    File "./tools/test_images.py", line 122, in
    dataset = get_dataset(args.dataset_name)
    File "/home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/factory.py", line 57, in get_dataset
    return __setsname
    File "/home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/factory.py", line 28, in
    datasets.YCBObject(split))
    File "/home/ys/PoseCNN-PyTorch-main/tools/../lib/datasets/ycb_object.py", line 75, in init
    self._extents = self._extents_all[cfg.TRAIN.CLASSES]
    IndexError: too many indices for array: array is 2-dimensional, but 21 were indexed

real 0m3.996s
user 0m3.744s
sys 0m1.939s

@zqf1234588
Copy link

Modify

self._extents = self._extents_all[cfg.TRAIN.CLASSES]

to

self._extents = self._extents_all[np.array(cfg.TRAIN.CLASSES)]

same as other places

@LDS666888
Copy link
Author

LDS666888 commented Jun 27, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants