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

Confusing error if prediction fails #2

Open
taw10 opened this issue Jun 29, 2023 · 0 comments
Open

Confusing error if prediction fails #2

taw10 opened this issue Jun 29, 2023 · 0 comments

Comments

@taw10
Copy link

taw10 commented Jun 29, 2023

If the server fails to return a valid result, the error message is somewhat confusing:

Connecting to server ...
[]
Received predictions in 0.1577 seconds
Client got all predictions in 0.1583 seconds
Traceback (most recent call last):
  File "./predict.py", line 170, in <module>
    loop_present, r, c, h, w = get_loop_bbox(predictions, min_size=args.min_size)
  File "./predict.py", line 52, in get_loop_bbox
    loop_present, r, c, h, w, r_max, c_max, r_min, c_min, bbox, area, notion_prediction = get_notion_prediction(predictions, ['crystal', 'loop_inside', 'loop'], k=k, min_size=min_size)
  File "./predict.py", line 125, in get_notion_prediction
    notion_mask = get_notion_mask_from_predictions(predictions, notion, k=k, notion_indices=notion_indices, threshold=threshold, min_size=min_size)
  File "./predict.py", line 90, in get_notion_mask_from_predictions
    notion_mask = np.zeros(predictions[0].shape[1:3], dtype=bool)
IndexError: list index out of range

Here, get_predictions was modified as follows:

   22     socket.send(pickle.dumps(request_arguments))                                                     
   23     raw_predictions = socket.recv()                                                                  
   24     predictions = pickle.loads(raw_predictions)                                                      
+  25     print(predictions)                                                                               
   26     if verbose:                                                                                      
   27         print('Received predictions in %.4f seconds' % (time.time() - start))                        
   28     return predictions                                                                               

The real error is that predictions is an empty list (in this case due to a different problem). This should be detected and trapped.

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

1 participant