Git Product home page Git Product logo

Comments (7)

MartinPlantinga avatar MartinPlantinga commented on June 28, 2024 5

Thanks guys! I did as @lsj910128 proposed and changed the lib/rpn/proposal_target_layer.py to force the values to be integers. After modifying this, the training script worked! This is the summary of the changes I made:

  1. replace the for loop in line 532 with:
for ind in inds:
        cls = clss[ind]
        start = 4 * cls
        end = start + 4
        start = int(start)
        end = int(end)
        bbox_targets[ind, start:end] = bbox_target_data[ind, 1:]
        bbox_inside_weights[ind, start:end] = cfg.TRAIN.BBOX_INSIDE_WEIGHTS
  1. replace the if statement in line 579 with:
if fg_inds.size > 0:
        fg_inds = npr.choice(fg_inds, size=int(fg_rois_per_this_image), replace=False)
  1. replace the if statement in line 590 with:
if bg_inds.size > 0:
        bg_inds = npr.choice(bg_inds, size=int(bg_rois_per_this_image), replace=False)
  1. replace line 597 with:
    labels[int(fg_rois_per_this_image):] = 0
  1. replace line 305 with:
roi_mask = -1 * np.ones((int(h), int(w)), dtype=np.float32)
  1. replace line 330 with:
mask_overlap = np.zeros((int(y2o-y1o), int(x2o-x1o)), dtype=np.float32)
  1. replace line 339 with:
mask_overlap_draw = color_img[int(y1o):int(y2o), int(x1o):int(x2o), :]
  1. replace line 347 with:
mask_overlap[:, :] = gt_mask[int(y1o):int(y2o), int(x1o):int(x2o)]
  1. replace line 352 with:
roi_mask[int(y1o-y1):int(y2o-y1), int(x1o-x1):int(x2o-x1)] = mask_overlap

from affordance-net.

lsj910128 avatar lsj910128 commented on June 28, 2024 2

I have had this problem before. Because I have no root user rights, so I directly change the code in rpn/proposal_target_layer.py", line 305
roi_mask = -1 * np.ones((int(h), int(w)), dtype=np.float32)

There are another places need to be change in the rpn/proposal_target_layer.py

from affordance-net.

nqanh avatar nqanh commented on June 28, 2024 2

You can manually convert the float indexes to integers. If it works, then it's ok.

from affordance-net.

nqanh avatar nqanh commented on June 28, 2024 1

This is a numpy version problem. I guess you're using version > 1.11.2, which doesn't support float index.

A quick fix is just to install numpy 1.11.2: sudo pip install numpy==1.11.2, then you don't have to change anything in the code.

from affordance-net.

nqanh avatar nqanh commented on June 28, 2024 1

You can fix the float index problem by converting the indexes to integer.
Or without root, you can try pip install numpy==1.11.2 --user. It will be installed on your local system, and there is no need to change the code :)

from affordance-net.

lsj910128 avatar lsj910128 commented on June 28, 2024 1

@nqanh Thanks a lot! It's a good means to solve this problem. You always can give us good advice!

from affordance-net.

deokisys avatar deokisys commented on June 28, 2024

@nqanh I did 'pip install numpy==1.11.2' but it doesn't work
if i did 'pip install numpy==1.11.2' then error message is

ImportError: numpy.core.multiarray failed to import

so, I reinstall >1.11 numpy then error message is

TypeError: slice indices must be integers or None or have an index method

so I fixed the code, then it worked
Could I solve this problem?

My environment is

anaconda2
python2.7.12
ubuntu14
cuda8.0
cudnn5.1

from affordance-net.

Related Issues (20)

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.