GithubHelp home page GithubHelp logo

create negative_py about cnn_face_detection HOT 9 OPEN

anson0910 avatar anson0910 commented on June 8, 2024
create negative_py

from cnn_face_detection.

Comments (9)

hqq1990 avatar hqq1990 commented on June 8, 2024 1

from cnn_face_detection.

anson0910 avatar anson0910 commented on June 8, 2024

Hi,
Sorry, the script is indeed kind of messy!
I think you can try modifying line 51 to exit(0) instead of break

from cnn_face_detection.

reza320 avatar reza320 commented on June 8, 2024

from cnn_face_detection.

anson0910 avatar anson0910 commented on June 8, 2024

Try adding print(number_of_pictures) on next line of line 14,
what does it print?

from cnn_face_detection.

reza320 avatar reza320 commented on June 8, 2024

from cnn_face_detection.

microhua avatar microhua commented on June 8, 2024

I have added some lines in the code, is it OK?

 for current_image in range((current_neg_dir - 1)*300, (current_neg_dir - 1)*300 + 300):    # take 300 images
        if current_image > (number_of_pictures - 1):
            break
        if current_image % 100 == 0:
            print "Processing image number " + str(current_image)
        read_img_name = data_base_dir + '/' + file_list[current_image].strip()
        img = cv2.imread(read_img_name)     # read image
        height, width, channels = img.shape

        crop_size = min(height, width) / 2  # start from half of shorter side

        while crop_size >= 12:
            for start_height in range(0, height, 100):
                if (start_height + crop_size) > height:
                    break
                for start_width in range(0, width, 100):
                    if (start_width + crop_size) > width:
                        break
                    cropped_img = img[start_height : start_height + int(crop_size), start_width : start_width + int(crop_size)]

from cnn_face_detection.

anson0910 avatar anson0910 commented on June 8, 2024

Yes, this should work!

from cnn_face_detection.

hqq1990 avatar hqq1990 commented on June 8, 2024

Hello, i'm also a beginner.
When i tried to modify the codes as you discuss.
It still said:"IndexError: list index out of range".

2018-06-10 4 02 16

2018-06-10 4 05 17

plz help me, thank you.

from cnn_face_detection.

anson0910 avatar anson0910 commented on June 8, 2024

Hi Hong,

I think the problem is wrong indentation compared to the code microhua pasted.
The code with the line starting from read_img_name should be indented to the right.

for current_image in range((current_neg_dir - 1)*300, (current_neg_dir - 1)*300 + 300):    # take 300 images
        if current_image > (number_of_pictures - 1):
            break
        if current_image % 100 == 0:
            print "Processing image number " + str(current_image)
        read_img_name = data_base_dir + '/' + file_list[current_image].strip()
        img = cv2.imread(read_img_name)     # read image
        height, width, channels = img.shape

        crop_size = min(height, width) / 2  # start from half of shorter side

        while crop_size >= 12:
            for start_height in range(0, height, 100):
                if (start_height + crop_size) > height:
                    break
                for start_width in range(0, width, 100):
                    if (start_width + crop_size) > width:
                        break
                    cropped_img = img[start_height : start_height + int(crop_size), start_width : start_width + int(crop_size)]

from cnn_face_detection.

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.