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

ValueError: a must be non-empty #6

Open
bzburr opened this issue Mar 1, 2019 · 8 comments
Open

ValueError: a must be non-empty #6

bzburr opened this issue Mar 1, 2019 · 8 comments

Comments

@bzburr
Copy link

bzburr commented Mar 1, 2019

823/1000 [=======================>......] - ETA: 3:08 - rpn_cls: 2.9711 - rpn_regr: 0.0832 - detector_cls: 0.3042 - detector_regr: 0.1486Traceback (most recent call last):
File "train_frcnn.py", line 261, in
selected_neg_samples = np.random.choice(neg_samples, C.num_rois - len(selected_pos_samples), replace=False).tolist()
File "mtrand.pyx", line 1126, in mtrand.RandomState.choice
ValueError: a must be non-empty

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "train_frcnn.py", line 263, in
selected_neg_samples = np.random.choice(neg_samples, C.num_rois - len(selected_pos_samples), replace=True).tolist()
File "mtrand.pyx", line 1126, in mtrand.RandomState.choice
ValueError: a must be non-empty

@kkawtar
Copy link

kkawtar commented Mar 11, 2019

did you found a solution for that ?

@hodaatef
Copy link

any one solved this error please???

@attilab97
Copy link

if len(neg_samples) != 0:
try:
selected_neg_samples = np.random.choice(neg_samples, C.num_rois - len(selected_pos_samples), replace=False).tolist()
except:
selected_neg_samples = np.random.choice(neg_samples, C.num_rois - len(selected_pos_samples), replace=True).tolist()
Just put a test before selecting negative samples.

@gdut3118007086
Copy link

if len(neg_samples) != 0:
try:
selected_neg_samples = np.random.choice(neg_samples, C.num_rois - len(selected_pos_samples), replace=False).tolist()
except:
selected_neg_samples = np.random.choice(neg_samples, C.num_rois - len(selected_pos_samples), replace=True).tolist()
Just put a test before selecting negative samples.

after that i meet another question

File "train_frcnn.py", line 275, in
loss_class = model_classifier.train_on_batch([X, X2[:, sel_samples, :]], [Y1[:, sel_samples, :], Y2[:, sel_samples, :]])
IndexError: index 4 is out of bounds for axis 1 with size 1

@gdut3118007086
Copy link

(any one solved this error please???)

@AdamJochna
Copy link

    if C.num_rois > 1:
        if len(pos_samples) < C.num_rois//2:
            selected_pos_samples = pos_samples.tolist()
        else:
            if len(pos_samples) > 0:
                selected_pos_samples = np.random.choice(pos_samples, C.num_rois//2, replace=False).tolist()
            else:
                selected_pos_samples = []
        try:
            if len(neg_samples) > 0:
                selected_neg_samples = np.random.choice(neg_samples, C.num_rois - len(selected_pos_samples), replace=False).tolist()
            else:
                selected_neg_samples = []
        except:
            if len(neg_samples) > 0:
                selected_neg_samples = np.random.choice(neg_samples, C.num_rois - len(selected_pos_samples), replace=True).tolist()
            else:
                selected_neg_samples = []

        sel_samples = selected_pos_samples + selected_neg_samples
    else:

@AdamJochna
Copy link

that seems to solve this issue

@Try2ChangeX
Copy link

I also met this problem. Anyone solve that? Help...

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

7 participants