ultralytics / yolov5

YOLOv5 🚀 in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
50.75k stars 16.34k forks source link

AttributeError: 'float' object has no attribute 'round' #1049

Closed universewill closed 4 years ago

universewill commented 4 years ago

get error when training on custom data:

File "train.py", line 459, in <module>
    train(hyp, opt, device, tb_writer)
  File "train.py", line 250, in train
    accumulate = max(1, np.interp(ni, xi, [1, nbs / total_batch_size]).round())
AttributeError: 'float' object has no attribute 'round'
github-actions[bot] commented 4 years ago

Hello @universewill, thank you for your interest in our work! Please visit our Custom Training Tutorial to get started, and see our Jupyter Notebook Open In Colab, Docker Image, and Google Cloud Quickstart Guide for example environments.

If this is a bug report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.

If this is a custom model or data training question, please note Ultralytics does not provide free personal support. As a leader in vision ML and AI, we do offer professional consulting, from simple expert advice up to delivery of fully customized, end-to-end production solutions for our clients, such as:

For more information please visit https://www.ultralytics.com.

universewill commented 4 years ago

updata numpy version according to requirement

amir-athari commented 3 years ago

Same problem here. Get this error when using numpy 1.19.4 in vscode AttributeError: 'float' object has no attribute 'round'

xieyj17 commented 3 years ago

I got a similar problem. My numpy version is 1.19.4

a = 1.23

round(a,1) # this one would work

a.round(1) # this one gives me error message "AttributeError: 'float' object has no attribute 'round'"

glenn-jocher commented 3 years ago

@xieyj17 round() by itself is a python op which will be slower on numpy arrays.

@xieyj17 @seedergy where exactly in the code are you seeing this error? Can you provide a reproducible example, i.e. in our colab notebook please?