Code Monkey home page Code Monkey logo

Comments (12)

orsveri avatar orsveri commented on August 22, 2024 6

I got the same error with wrong y-coordinates with python 3.6. I fixed it when replaced line 294 in yolo3_one_file_to_detect_them_all.py:
row = i / grid_w
with
row = i // grid_w

Hope it will help

from keras-yolo3.

szxwpp avatar szxwpp commented on August 22, 2024 1

@experiencor thank you for your help. you are right, the letterbox_image will get a higher mAP. The resize_image just work well on some images. maybe somehting is wrong with the rounding just like @JaspervDalen said. I also get the wrong result by python 3.6, and get the correct result by python 2.7

from keras-yolo3.

experiencor avatar experiencor commented on August 22, 2024

Are you sure you are running my code? My result is a bit different.
dog_detected

And do you actually run darknet yolo3 or just take the picture from the paper?

from keras-yolo3.

szxwpp avatar szxwpp commented on August 22, 2024

I try all steps again, and get the same result. the coordinates of bbox are also wrong.

  1. get the 'dog.jpg' image from repositories( https://github.com/pjreddie/darknet.git)
  2. download the yolov3.weights (wget https://pjreddie.com/media/files/yolov3.weights)
  3. download your code again, and then run: python yolo3_one_file_to_detect_them_all.py -w yolov3.weights -i dog.jpg

the environment:
ubuntu 16.04 tensorflow 1.7 keras 2.1.5

just now, i do all steps on another computer again, the result are also wrong.
are you sure your test code is same as the repositories a14aa4e

from keras-yolo3.

experiencor avatar experiencor commented on August 22, 2024

Yes, it is. I never change that python file since it's working. I also note that your probabilities are rounded to 2 decimal places, which are different from mine.

Darknet dog (actually run the darknet yolo3):

darknet_dog

My dog (yolov3.weights => yolov3.h5 => predict.py):

my_dog

from keras-yolo3.

JaspervDalen avatar JaspervDalen commented on August 22, 2024

I have the same results as @szxwpp but I use python3 and I think somehting is wrong with the rounding. However besides noticing that it was wrong I didn't have time to find the mistake and fix it.

from keras-yolo3.

szxwpp avatar szxwpp commented on August 22, 2024

@experiencor so sorry for the late reply. my probabilities are rounded to 2 decimal places only when drawing bboxs, it is after detection.
dog_detected

i used cv2:resize to replace letterbox_image, and calculate the coordinates without x_offset, x_scale and so on, then the result is correct.

from keras-yolo3.

experiencor avatar experiencor commented on August 22, 2024

letterbox_image is important.

from keras-yolo3.

JudyMRSD avatar JudyMRSD commented on August 22, 2024

I also got bounding boxes at wrong location, same as @szxwpp. May I have the piece of code you @szxwpp did to fix it? Not quit sure how to change the code based on "used cv2:resize to replace letterbox_image, and calculate the coordinates without x_offset, x_scale and so on".

This might just be I'm using a different version of some python package.
I'm using Python 3.6, keras = 2.1.2, tensorflow 1.5.1 on a mac os.
May I have something like a environment.yml for anoconda for your repo @experiencor?

Thanks a lot!

from keras-yolo3.

experiencor avatar experiencor commented on August 22, 2024

"used cv2:resize to replace letterbox_image, and calculate the coordinates without x_offset, x_scale and so on" is the wrong way to do things. Just use my code exactly. Fine with both 2.7 and 3.6.

from keras-yolo3.

JudyMRSD avatar JudyMRSD commented on August 22, 2024

Thank you very much for the quick reply! I have Python 3.6, Keras 2.1.2, tensorflow 1.5.1

I used command:
python yolo3_one_file_to_detect_them_all.py -w yolov3.weights -i dog.jpg

Do you have some suggestions for where I may look at to make the bounding box same as your result?
Here is the bounding box information I got when printing them out in the draw_boxes function.
The vertices matches what's shown in image, so maybe I got different values before entering this function:
bicycle: 99.36379194259644%
box vertex 164 141 562 471
dog: 98.62090945243835%
box vertex 128 236 313 551
truck: 92.9111659526825%
box vertex 473 106 689 192

Here is where I added print statements:

    for i in range(len(labels)):
        if box.classes[i] > obj_thresh:
            label_str += labels[i]
            label = i
            print(labels[i] + ': ' + str(box.classes[i]*100) + '%')
            print("box vertex", box.xmin, box.ymin, box.xmax, box.ymax)

dog_detected

from keras-yolo3.

JudyMRSD avatar JudyMRSD commented on August 22, 2024

Thank you for your help @experiencor ! Bounding box is correct now : ) In case anyone has the same issue, I'm using Ubuntu 16.04.3, python 2.7 and Keras 2.1.2, tensorflow 1.8

from keras-yolo3.

Related Issues (20)

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.