jswulff / pcaflow

Other
87 stars 29 forks source link

IndexError: only integers, slices (`:`) #1

Open anthony-chaudhary opened 7 years ago

anthony-chaudhary commented 7 years ago

Hello,

Your code looks awesome! I'm trying to get it running on my machine, and I'm bumping into this error: not sure what I'm doing wrong?

On a Linux Ubuntu 16.04 machine, ran the build.sh script, appear to have prerequisites installed. Running python compute_flow.py -kitti -pcaflow image1.png image2.png output.flo as shown:

(py2) anthony@aZ68MA-D2H-B3:/media/anthony/CA80455D8045515D/code-2tb/pcaflow$ python compute_flow.py -kitti -pcaflow image1.png image2.png output.flo
/media/anthony/CA80455D8045515D/code-2tb/pcaflow/pcaflow
*** LOADING PRESET pcaflow_kitti ***

[PARAMETERS MAIN]

    NC:     500
    SUBLAYER_NC:    200
    SUBLAYER_lambda:    0.02
    SUBLAYER_sigma:     0.95
    debug:  0
    em_additional_remove_outliers:  0
    em_init_loc_weight:     0.4
    features:   libviso
    features_clahe:     1
    features_fast_limit:    -1
    features_libviso_bucket_size:   50
    features_libviso_buckets_x:     8
    features_libviso_buckets_y:     4
    features_libviso_half_resolution:   0
    features_libviso_match_binsize:     50
    features_libviso_match_disp_tolerance:  1
    features_libviso_match_radius:  200
    features_libviso_multi_stage:   1
    features_libviso_multiscale:    0
    features_libviso_n_scales:  2
    features_libviso_nms_n:     5
    features_libviso_nms_tau:   25
    features_libviso_outlier_disp_tolerance:    5
    features_libviso_outlier_flow_tolerance:    7
    features_libviso_refinement:    1
    features_prune_border:  0.05
    image_blur:     5
    lambda:     0.4
    model_color_n_mixtures:     1
    model_factor_dist_to_median:    0.008
    model_gamma:    350.0
    model_gamma_c:  5.0
    model_gamma_l:  6.5
    model_gamma_warp:   1.0
    model_sigma_w:  300.0
    n_models:   1
    remove_homography:  0
    sigma:  0.55
Initializing matcher...
NC: 
500
NC_MAX_PER: 
250
WARNING: Image changed size. (0,0 => 435,1024).
Re-allocating matcher...
Traceback (most recent call last):
  File "compute_flow.py", line 67, in <module>
    main()
  File "compute_flow.py", line 59, in main
    u,v = P.compute_flow()
  File "/media/anthony/CA80455D8045515D/code-2tb/pcaflow/pcaflow/PCAFlow.py", line 315, in compute_flow
    kp1_,kp2_ = self.feature_matcher.get_features()
  File "/media/anthony/CA80455D8045515D/code-2tb/pcaflow/pcaflow/features/FeatureMatcherLibviso.py", line 175, in get_features
    feats_I1,feats_I2 = self.prune_second_stage(feats_I1.copy(),feats_I2.copy(),self.w,self.h) 
  File "/media/anthony/CA80455D8045515D/code-2tb/pcaflow/pcaflow/features/FeatureMatcherLibviso.py", line 198, in prune_second_stage
    if not bin_occupied[b]:
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
anthony-chaudhary commented 7 years ago

Taking another look at: pcaflow/pcaflow/features/FeatureMatcherLibviso.py", line 198,

this seems to work:

b = xbins * (k[1] // bh) + k[0]//bw to

b = int (xbins * (k[1] // bh) + k[0]//bw)

Guessing python converting to a float with the multiplication operation?