Giter VIP home page Giter VIP logo

when i was training my data,there is a issue exist as follow:> d:\orgin\faster-rcnn-tensorflow-python3.5-master\faster-rcnn-tensorflow-python3.5-master\lib\layer_utils\proposal_target_layer.py(139)_sample_rois() -> keep_inds = np.append(fg_inds, bg_inds) (Pdb) about faster-rcnn-tensorflow-python3 HOT 31 CLOSED

tdf1995 avatar tdf1995 commented on June 10, 2024
when i was training my data,there is a issue exist as follow:> d:\orgin\faster-rcnn-tensorflow-python3.5-master\faster-rcnn-tensorflow-python3.5-master\lib\layer_utils\proposal_target_layer.py(139)_sample_rois() -> keep_inds = np.append(fg_inds, bg_inds) (Pdb)

from faster-rcnn-tensorflow-python3.

Comments (31)

morpheusthewhite avatar morpheusthewhite commented on June 10, 2024 2

I solved by raising an exception instead of opening pdb

(in lib/layer_util/proposal_target_layer.py)

    if fg_inds.size > 0 and bg_inds.size > 0:
        fg_rois_per_image = min(fg_rois_per_image, fg_inds.size)
        fg_inds = npr.choice(fg_inds, size=int(fg_rois_per_image), replace=False)
        bg_rois_per_image = rois_per_image - fg_rois_per_image
        to_replace = bg_inds.size < bg_rois_per_image
        bg_inds = npr.choice(bg_inds, size=int(bg_rois_per_image), replace=to_replace)
    elif fg_inds.size > 0:
        to_replace = fg_inds.size < rois_per_image
        fg_inds = npr.choice(fg_inds, size=int(rois_per_image), replace=to_replace)
        fg_rois_per_image = rois_per_image
    elif bg_inds.size > 0:
        to_replace = bg_inds.size < rois_per_image
        bg_inds = npr.choice(bg_inds, size=int(rois_per_image), replace=to_replace)
        fg_rois_per_image = 0
    else:
        raise Exception()

and catching it in train.py

     # Compute the graph with summary
     try:
           rpn_loss_cls, rpn_loss_box, loss_cls, loss_box, total_loss = self.net.train_step(sess, blobs, train_op)
     except Exception:
           print('image invalid, skipping')
           continue

from faster-rcnn-tensorflow-python3.

xupinjie avatar xupinjie commented on June 10, 2024

i met the same problem.
did you solve it?

from faster-rcnn-tensorflow-python3.

tdf1995 avatar tdf1995 commented on June 10, 2024

@Jasonxu033 there is a problem in my dataset

from faster-rcnn-tensorflow-python3.

xupinjie avatar xupinjie commented on June 10, 2024

@tdf1995 what problem?

from faster-rcnn-tensorflow-python3.

niuniu111 avatar niuniu111 commented on June 10, 2024

I met the same problem. keep_inds = np.append(fg_inds, bg_inds) (Pdb), did you solve it?

from faster-rcnn-tensorflow-python3.

xupinjie avatar xupinjie commented on June 10, 2024

@niuniu111 Some probles in your dateset. There are some pictures couldnot fit the annotation.

from faster-rcnn-tensorflow-python3.

niuniu111 avatar niuniu111 commented on June 10, 2024

I use VGG16 to run normally. When running RESNET, there is a similar error. Does this mean that the data is OK?

from faster-rcnn-tensorflow-python3.

xupinjie avatar xupinjie commented on June 10, 2024

@niuniu111 sorry i didn't try resnet

from faster-rcnn-tensorflow-python3.

lccate avatar lccate commented on June 10, 2024

I changed the learning rate from 0.0001 to 0.1,then the (Pdb) error occurs, I hope it will help you

from faster-rcnn-tensorflow-python3.

LarryJiang134 avatar LarryJiang134 commented on June 10, 2024

For me, this error occurs randomly. I have trained entire pascal voc before yet the second day when I tried to train the network, I saw this error message. I don't think it is code which is problematic. This might because my GPU or RAM are not stable. Try to run it on another device.
Just my observation. Hope it is helpful.

from faster-rcnn-tensorflow-python3.

niuniu111 avatar niuniu111 commented on June 10, 2024

It's hopeful,Thanks

from faster-rcnn-tensorflow-python3.

kmust-why avatar kmust-why commented on June 10, 2024

imdb.append_flipped_images() Will this code affect?

from faster-rcnn-tensorflow-python3.

yhs95 avatar yhs95 commented on June 10, 2024

f:\pycode\faster-rcnn-tensorflow-python3.5-master\lib\layer_utils\proposal_tar
get_layer.py(138)_sample_rois()
-> keep_inds = np.append(fg_inds, bg_inds)
(Pdb)

from faster-rcnn-tensorflow-python3.

kmust-why avatar kmust-why commented on June 10, 2024

Is training your own data set?

from faster-rcnn-tensorflow-python3.

kmust-why avatar kmust-why commented on June 10, 2024

You can try to reduce the value of SCALES.

from faster-rcnn-tensorflow-python3.

yhs95 avatar yhs95 commented on June 10, 2024

I tried it, is it modified in config.py? How much is it appropriate to change the value of SCALES?

from faster-rcnn-tensorflow-python3.

kmust-why avatar kmust-why commented on June 10, 2024

I use SCALES = [1,2,4,8,16], RATIOS = [0.5,1,2], you can try it.

from faster-rcnn-tensorflow-python3.

yhs95 avatar yhs95 commented on June 10, 2024

The picture I used for training is a grayscale image.According to what you said, using SCALES = [1,2,4,8,16], RATIOS = [0.5,1,2] will not work.As shown.After entering c, this result appears
InvalidArgumentError (see above for traceback): Incompatible shapes: [0,24] vs.
[256,24]。

from faster-rcnn-tensorflow-python3.

kmust-why avatar kmust-why commented on June 10, 2024

Have you solved this problem later? I have encountered this problem again today.

from faster-rcnn-tensorflow-python3.

Tju-AI avatar Tju-AI commented on June 10, 2024

This problem appears after completing several rounds of training

same question,have you solved it??

from faster-rcnn-tensorflow-python3.

niuniu111 avatar niuniu111 commented on June 10, 2024

The picture I used for training is a grayscale image.According to what you said, using SCALES = [1,2,4,8,16], RATIOS = [0.5,1,2] will not work.As shown.After entering c, this result appears
InvalidArgumentError (see above for traceback): Incompatible shapes: [0,24] vs.
[256,24]。

same question, have you solved this problem? What is the reason?

from faster-rcnn-tensorflow-python3.

niuniu111 avatar niuniu111 commented on June 10, 2024

Some probles in your dateset. There are some pictures couldnot fit the annotation.

I also meet the question,I want to know what mean "there are some pictures could not fit the annotation."can you answer the question specifically?

from faster-rcnn-tensorflow-python3.

morpheusthewhite avatar morpheusthewhite commented on June 10, 2024

Same question

from faster-rcnn-tensorflow-python3.

morpheusthewhite avatar morpheusthewhite commented on June 10, 2024

It seems to be caused by the following lines

    if fg_inds.size > 0 and bg_inds.size > 0:
        fg_rois_per_image = min(fg_rois_per_image, fg_inds.size)
        fg_inds = npr.choice(fg_inds, size=int(fg_rois_per_image), replace=False)
        bg_rois_per_image = rois_per_image - fg_rois_per_image
        to_replace = bg_inds.size < bg_rois_per_image
        bg_inds = npr.choice(bg_inds, size=int(bg_rois_per_image), replace=to_replace)
    elif fg_inds.size > 0:
        to_replace = fg_inds.size < rois_per_image
        fg_inds = npr.choice(fg_inds, size=int(rois_per_image), replace=to_replace)
        fg_rois_per_image = rois_per_image
    elif bg_inds.size > 0:
        to_replace = bg_inds.size < rois_per_image
        bg_inds = npr.choice(bg_inds, size=int(rois_per_image), replace=to_replace)
        fg_rois_per_image = 0
    else:
        import pdb
        pdb.set_trace()  # <----- this command launches python debugger and so it stops execution

    # The indices that we're selecting (both fg and bg)
    keep_inds = np.append(fg_inds, bg_inds)

Even if the error refers to the append the stop is caused by pdb.set_trace(). That line of code was put there probably to debug some unwanted situation regarding overlapping buonding boxes

from faster-rcnn-tensorflow-python3.

Monti03 avatar Monti03 commented on June 10, 2024

if you are using pascal_voc.py to deal with your dataset, you can try to remove -1 from _load_pascal_annotation in those rows:
x1 = float(bbox.find('xmin').text) - 1
y1 = float(bbox.find('ymin').text) - 1
x2 = float(bbox.find('xmax').text) - 1
y2 = float(bbox.find('ymax').text) - 1

from faster-rcnn-tensorflow-python3.

niuniu111 avatar niuniu111 commented on June 10, 2024

when I use your approach, an exception is rainsing,which is proved image is wrong?@morpheusthewhite

from faster-rcnn-tensorflow-python3.

morpheusthewhite avatar morpheusthewhite commented on June 10, 2024

@niuniu111 yes, it is raised every time something in your dataset is not correct.
I met that problem when the annotation was associated to the wrong image; you should check it out

from faster-rcnn-tensorflow-python3.

gwspotex avatar gwspotex commented on June 10, 2024

that's mean your fg & bg all return 0..
step1:
u can print the fg & bg then u can find it in dataset
step2:
if the dataset is OK u probably change RPN to small anchor & ratio
step3:
u can e-Maill to me :[email protected]

from faster-rcnn-tensorflow-python3.

gwspotex avatar gwspotex commented on June 10, 2024

that's mean your fg & bg all return 0..
step1:
u can print the fg & bg then u can find it in dataset
step2:
if the dataset is OK u probably change RPN to small anchor & ratio
step3:
u can e-Maill to me :[email protected]

from faster-rcnn-tensorflow-python3.

PangJian123 avatar PangJian123 commented on June 10, 2024

i solve it.
First,find two lines in config.py:
tf.app.flags.DEFINE_float('roi_bg_threshold_high', 0.5, "Overlap threshold for a ROI to be considered background (class = 0 if overlap in [LO, HI))")
tf.app.flags.DEFINE_float('roi_bg_threshold_low', 0.1, "Overlap threshold for a ROI to be considered background (class = 0 if overlap in [LO, HI))")
Second,I modify two values :0.5 changed to 0.3 and 0.1 changed to 0.0.
I hope it can help you.

from faster-rcnn-tensorflow-python3.

dBeker avatar dBeker commented on June 10, 2024

@morpheusthewhite can you send your changes as PR?

from faster-rcnn-tensorflow-python3.

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.