Code Monkey home page Code Monkey logo

Comments (23)

miranthajayatilake avatar miranthajayatilake commented on June 2, 2024 36

So I found the solution:

The yolo.h5 file can be generated using the YAD2K repository here: https://github.com/allanzelener/YAD2K

Steps how to do it on windows:

Run python yad2k.py yolo.cfg yolo.weights model_data/yolo.h5 on the shell and the h5 file will be generated.

from deeplearning.ai.

Estapraq avatar Estapraq commented on June 2, 2024 3

Just go to Yolo website and download it
https://pjreddie.com/darknet/yolo/

from deeplearning.ai.

HanYuanyuaner avatar HanYuanyuaner commented on June 2, 2024 1

@miranthajayatilake the link for yolo.cfg not worked.

from deeplearning.ai.

msomeha avatar msomeha commented on June 2, 2024 1

You can get the weights and cfg file from this website.
https://pjreddie.com/darknet/yolo/

The coursera course is using YOLOv2 608 x 608. You will need tensoflow v1 to compile.

from deeplearning.ai.

geserit5 avatar geserit5 commented on June 2, 2024 1

I get a error message when I run yad2k.py
"Traceback (most recent call last):
File "yad2k.py", line 270, in
_main(parser.parse_args())
File "yad2k.py", line 156, in _main
buffer=weights_file.read(weights_size * 4))
TypeError: buffer is too small for requested array "
Any suggestions?

from deeplearning.ai.

dineshmane avatar dineshmane commented on June 2, 2024

Thanks it helped 👍

from deeplearning.ai.

ShawnZhong avatar ShawnZhong commented on June 2, 2024

Use this one:
https://raw.githubusercontent.com/pjreddie/darknet/master/cfg/yolov1.cfg

from deeplearning.ai.

anubhav0fnu avatar anubhav0fnu commented on June 2, 2024

@miranthajayatilake , I am not able to download the configuration file? the link isn't valid! Also, does the Yolo weight corresponds to version2 or version 3?

from deeplearning.ai.

Sameedquais avatar Sameedquais commented on June 2, 2024

So I found the solution:

The yolo.h5 file can be generated using the YAD2K repository here: https://github.com/allanzelener/YAD2K

Steps how to do it on windows:

Run python yad2k.py yolo.cfg yolo.weights model_data/yolo.h5 on the shell and the h5 file will be generated.

from deeplearning.ai.

Sameedquais avatar Sameedquais commented on June 2, 2024

Can anyone explain this step. I have downloaded both cfg and weight file. I don't understand where and how to run it?

Run python yad2k.py yolo.cfg yolo.weights model_data/yolo.h5 on the shell and the h5 file will be generated.

from deeplearning.ai.

iamsurya avatar iamsurya commented on June 2, 2024

Folks, this code is from deeplearning.ai/ and you can sign up for their free course and work this out.

from deeplearning.ai.

creative-h avatar creative-h commented on June 2, 2024

Can anyone explain this step. I have downloaded both cfg and weight file. I don't understand where and how to run it?

Run python yad2k.py yolo.cfg yolo.weights model_data/yolo.h5 on the shell and the h5 file will be generated.
@Sameedquais
you should run in command prompt or Anaconda prompt with same directory as YAD2K master.

from deeplearning.ai.

VEDANTKHARE-JEC avatar VEDANTKHARE-JEC commented on June 2, 2024

how can i run it in google colab?

from deeplearning.ai.

kaushil24 avatar kaushil24 commented on June 2, 2024

how can i run it in google colab?

  1. Clone repo using !git clone https://github.com/allanzelener/YAD2K.git
  2. Go inside the directory using os.chdir(folder_name)
  3. Get the weights with:
!wget https://pjreddie.com/media/files/yolov2-voc.weights
!wget https://raw.githubusercontent.com/pjreddie/darknet/master/cfg/yolov2-voc.cfg
  1. Run !python3 yad2k.py yolov2-voc.cfg yolov2-voc.weights model_data/yolov2-voc.h5

Tip: To run any terminal command on colab you can use ! before the command. Refer this

from deeplearning.ai.

Mr-Zhu-pg avatar Mr-Zhu-pg commented on June 2, 2024

I get a error message when I run yad2k.py
"Traceback (most recent call last):
File "yad2k.py", line 270, in
_main(parser.parse_args())
File "yad2k.py", line 156, in _main
buffer=weights_file.read(weights_size * 4))
TypeError: buffer is too small for requested array "
Any suggestions?

Hi, we must make yolo.cfg and yolo.weights have the same version, yolo having many versions like yolo-tiny,yolov1,yolov2,yolov3....

from deeplearning.ai.

galla-rupesh avatar galla-rupesh commented on June 2, 2024

You can get the weights and cfg file from this website.
https://pjreddie.com/darknet/yolo/

The coursera course is using YOLOv2 608 x 608. You will need tensoflow v1 to compile.

Hi, but to degrade tensorflow to v1, yolo.utils is using keras which needs tf v>2.0 then how to proceed? and while using yolov2 h5 file in tf version 2.4.0, its giving error "yad2k.models.keras_yolo is not loaded, but a Lambda layer uses it. It may cause errors." while loading model. any suggestions please?

from deeplearning.ai.

MasoumehVahedi avatar MasoumehVahedi commented on June 2, 2024

Can anyone explain this step. I have downloaded both cfg and weight file. I don't understand where and how to run it?

Run python yad2k.py yolo.cfg yolo.weights model_data/yolo.h5 on the shell and the h5 file will be generated.
Could you help me how to copy cfg and weigth file on master directory in google colab? I got error when I want to run python yad2k.py yolo.cfg yolo.weights model_data/yolo.h5 on the shell and the h5

from deeplearning.ai.

NCcoco avatar NCcoco commented on June 2, 2024

thank you

from deeplearning.ai.

Akhil-Tony avatar Akhil-Tony commented on June 2, 2024

anybody have a pre trained yolo 1 weight.h5 file ?

from deeplearning.ai.

khaledhasanzami avatar khaledhasanzami commented on June 2, 2024

I get a error message when I run yad2k.py
"Traceback (most recent call last):
File "yad2k.py", line 270, in
_main(parser.parse_args())
File "yad2k.py", line 156, in _main
buffer=weights_file.read(weights_size * 4))
TypeError: buffer is too small for requested array "
Any suggestions?

Hi, we must make yolo.cfg and yolo.weights have the same version, yolo having many versions like yolo-tiny,yolov1,yolov2,yolov3....

I have the same version, it is still showing this error

from deeplearning.ai.

parsa-pico avatar parsa-pico commented on June 2, 2024

for anyone who still has this problem in tensorflow 2,go to original website of yolov2 and download darknet and weights file,find yolo config in darknet folder, then using yad2k you can easily generate .h5 file,(when running yad2k.py you get bunch of import errors that you have to manually correct them because of new version of tensorflow)
yolo v2site:
https://pjreddie.com/darknet/yolov2/
installing yad2k:
git clone https://github.com/allanzelener/yad2k.git
put config and weight file inside yad2k folder
if you get space_to_depth err, go to the corresponding line and change it to tf.nn.space_to_depth

from deeplearning.ai.

tusharsinghsoam avatar tusharsinghsoam commented on June 2, 2024

I am getting the following error:

Loading weights.
Weights Header: [ 0 1 0 32013312]
Parsing Darknet config.
Traceback (most recent call last):
File "C:\Users\tsoam\Downloads\YAD2K\yad2k.py", line 274, in
_main(parser.parse_args())
File "C:\Users\tsoam\Downloads\YAD2K\yad2k.py", line 95, in _main
cfg_parser.read_file(unique_config_file)
File "C:\Users\tsoam\AppData\Local\Programs\Python\Python311\Lib\configparser.py", line 733, in read_file
self._read(f, source)
File "C:\Users\tsoam\AppData\Local\Programs\Python\Python311\Lib\configparser.py", line 1100, in _read
raise MissingSectionHeaderError(fpname, lineno, line)
configparser.MissingSectionHeaderError: File contains no section headers.

Note: I have already manually corrected import statements as I am using tf 2.13, Python version 3.11.

from deeplearning.ai.

tusharsinghsoam avatar tusharsinghsoam commented on June 2, 2024

I am getting the following error:

Loading weights. Weights Header: [ 0 1 0 32013312] Parsing Darknet config. Traceback (most recent call last): File "C:\Users\tsoam\Downloads\YAD2K\yad2k.py", line 274, in _main(parser.parse_args()) File "C:\Users\tsoam\Downloads\YAD2K\yad2k.py", line 95, in _main cfg_parser.read_file(unique_config_file) File "C:\Users\tsoam\AppData\Local\Programs\Python\Python311\Lib\configparser.py", line 733, in read_file self._read(f, source) File "C:\Users\tsoam\AppData\Local\Programs\Python\Python311\Lib\configparser.py", line 1100, in _read raise MissingSectionHeaderError(fpname, lineno, line) configparser.MissingSectionHeaderError: File contains no section headers.

Note: I have already manually corrected import statements as I am using tf 2.13, Python version 3.11.

I solved this by directly downloading yolov2.cfg from GitHub repo rather than using curl. I think curl messes up the format of the file.

from deeplearning.ai.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.