question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AttributeError: 'int' object has no attribute 'astype'

See original GitHub issue

In file “./faster-rcnn.pytorch-master/lib/roi_data_layer/roibatchLoader.py” line:54, self.ratio_list_batch[left_idx:(right_idx+1)] = torch.tensor(target_ratio.astype(np.float64)) # trainset ratio list ,each batch is same number I met the error AttributeError: 'int' object has no attribute 'astype'. My sovle method is remove ‘astype(np.float64)’. Although there is no error, is it right ? Has it effect on experients result?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

8reactions
GGOBONDcommented, Jun 16, 2019

/lib/roi_data_layer/roibatchLoader.py line 52, target_ratio = 1 change to: target_ratio = np.array(1)

0reactions
ZiyuBaocommented, Nov 21, 2019

@wangken1994 Exactly the same problem as yours.

I downgrade Pytorch from version 0.4.0 to 0.3.0 and got the error. If I do not downgrade it, I will encounter a FileNotFoundError. Related comments: https://github.com/pytorch/pytorch/issues/6932#issuecomment-557059493, https://github.com/jwyang/faster-rcnn.pytorch/issues/199#issuecomment-557062508, https://github.com/jwyang/faster-rcnn.pytorch/issues/421#issuecomment-557061870.

How did you solve it in the end?

Read more comments on GitHub >

github_iconTop Results From Across the Web

AttributeError: 'int' object has no attribute 'astype' #613 - GitHub
it worked. now i am getting : File "/content/drive/My Drive/fasterrcnn18nov/faster-rcnn.pytorch/lib/model/rpn/proposal_target_layer_cascade.py", ...
Read more >
'float' object has no attribute 'astype' - Stack Overflow
I am trying to find median values in a column of the dataframe. The median value that I am getting is float but...
Read more >
AttributeError: 'list' object has no attribute 'astype' | bobbyhadz
The Python "AttributeError: 'list' object has no attribute 'astype'" occurs when we try to call the astype() method on a list. To solve...
Read more >
Error converting to string using astype(str) - DQ Courses
Integers do not have the method .astype(str), but you can apply the function str() which is designed to take an integer as an...
Read more >
How to convert float into int in pandas? - Intellipaat Community
The code I am using for converting the float into int is as follows: users.age.mean(). ... AttributeError: 'float' object has no attribute ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found