# I am using roboflow dataset to train yolov4 pytorch but why did I get this error? Can someone help? Thank you

**URL:** <https://discuss.roboflow.com/t/i-am-using-roboflow-dataset-to-train-yolov4-pytorch-but-why-did-i-get-this-error-can-someone-help-thank-you/450>\
**Category:** 🤝  Community Help\
**Created:** [May 18, 2022, 2:15am UTC](https://discuss.roboflow.com/t/i-am-using-roboflow-dataset-to-train-yolov4-pytorch-but-why-did-i-get-this-error-can-someone-help-thank-you/450 "2022-05-18T02:15:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MheadHero](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/mheadhero/32/221_2.png) [@MheadHero](https://discuss.roboflow.com/u/MheadHero)\
**Post date:** [May 18, 2022, 2:15am UTC](https://discuss.roboflow.com/t/i-am-using-roboflow-dataset-to-train-yolov4-pytorch-but-why-did-i-get-this-error-can-someone-help-thank-you/450/1 "2022-05-18T02:15:36Z")

</div>

Object detection problem  
YOLOv4 pytorch from: [GitHub - Tianxiaomo/pytorch-YOLOv4: PyTorch ,ONNX and TensorRT implementation of YOLOv4](https://github.com/Tianxiaomo/pytorch-YOLOv4)

Why when I using roboflow dataset and use it in YOLOv4 pytorch, it appears this error?  
**ValueError: invalid literal for int() with base 10: ‘000037\_jpg.rf.5c9063a3fc4352fed0729e91f7a6f508’**

 ![image](https://canada1.discourse-cdn.com/flex029/uploads/roboflow1/original/1X/6cb4a8a669a37ea74324ae972e1876e454ea01e0.png)  
Noted that I am using YOLOv4 pytorch from [GitHub - Tianxiaomo/pytorch-YOLOv4: PyTorch ,ONNX and TensorRT implementation of YOLOv4](https://github.com/Tianxiaomo/pytorch-YOLOv4) not yours because yours didnt output mAP

---

<div class="post-metadata">

**Author:** ![anon59033456](https://avatars.discourse-cdn.com/v4/letter/a/a88e57/32.png) [@anon59033456](https://discuss.roboflow.com/u/anon59033456)\
**Post date:** [May 18, 2022, 2:22pm UTC](https://discuss.roboflow.com/t/i-am-using-roboflow-dataset-to-train-yolov4-pytorch-but-why-did-i-get-this-error-can-someone-help-thank-you/450/2 "2022-05-18T14:22:52Z")

</div>

Hi @MheadHero

I found the same error in the `Issues` section on the repo you shared. Have you tried eg: `int(float("50.00"))` ? Below is the issue for reference

> <https://github.com/Tianxiaomo/pytorch-YOLOv4/issues/189>
>
> Hello!
> 
> Thank you for this great library! I trained the model, and I created a… demo successfully with the darknet library. Based on this I guess, that .cfg and .data files are okay. I tried to convert a darknet yolov4 model to PyTorch one, and I got this error:
> 
> \`\`\`bash
> Traceback (most recent call last):
> File "demo.py", line 155, in \<module\>
> detect\_cv2(args.cfgfile, args.weightfile, args.imgfile)
> File "demo.py", line 27, in detect\_cv2
> m = Darknet(cfgfile)
> File "/content/pytorch-YOLOv4/tool/darknet2pytorch.py", line 144, in \_\_init\_\_
> self.models = self.create\_network(self.blocks) # merge conv, bn,leaky
> File "/content/pytorch-YOLOv4/tool/darknet2pytorch.py", line 254, in create\_network
> filters = int(block\['filters'\])
> ValueError: invalid literal for int() with base 10: '30 #255'
> \`\`\`
> 
> My cfg file: https://drive.google.com/file/d/150ow6bVbUcNcPvyh8UajDpLtgOjmr8ub/view?usp=sharing
> My weights: https://drive.google.com/file/d/1-RPnDFn9\_Q1z4bQKDxkcNYPoUBPAPGWT/view?usp=sharing
> 
> Library versions:
> \`\`\`
> numpy==1.18.2
> torch==1.4.0
> tensorboardX==2.0
> \`\`\`
> 
> What causes the error?

---

<div class="post-metadata">

**Author:** ![MheadHero](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/mheadhero/32/221_2.png) [@MheadHero](https://discuss.roboflow.com/u/MheadHero)\
**Post date:** [May 18, 2022, 2:30pm UTC](https://discuss.roboflow.com/t/i-am-using-roboflow-dataset-to-train-yolov4-pytorch-but-why-did-i-get-this-error-can-someone-help-thank-you/450/3 "2022-05-18T14:30:50Z")

</div>

Hi, actually I look thru all this repo already. I found that this is the issue happens when the dataset.py file want to get the unique key. And the problem now is, roboflow export the dataset with the filename of 2 types.

1. 000133\_JPG.rf.6cad57dd6917906c1577a643ebb339a1.jpg
2. IMG\_4852\_JPG.rf.3e0f1a273ca0769c5c981929159d32a0.jpg

So when it comes to a yolov4 function which is **get\_img\_id()**. The purpose of this function is to create unique key for all images.

So, how can I create my own **get\_img\_id()** to fullfil the 2 conditions from roboflow dataset?  
Noted that the unique id in yolov4 must be integer.
