Python programming tutorials how to save lots of money fast

While you *can* do this in windows, I would not suggest it. Thus, for this tutorial, I am going to be using a linux VPS, and I recommend you do the same. You can try to use the free tier from amazon how to save lots of money fast web services, though it may be painfully too slow for you, and you will likely need more RAM. You can also get a VPS from digital ocean for how to save lots of money fast as low as $5/month. I would recommend at least 2GB of RAM for what how to save lots of money fast we will be doing. Most hosts nowadays charge by the hour, including digital ocean. Thus, you can buy a $20/mo server, use it for a day, take the files you want, and then terminate the server and pay a very small how to save lots of money fast amount of money. Do you need more help setting up the server? If so, check out this specific tutorial.

Now, how do we actually go about this process? So when you want to build a haar cascade, you need "positive" images, and "negative" images. The "positive" images are images that contain the object you want to how to save lots of money fast find. This can either be images that just mainly have the how to save lots of money fast object, or it can be images that contain the object, and you specify the ROI (region of interest) where the object is. With these positives, we build a vector file that is basically all of how to save lots of money fast these positives put together. One nice thing about the positives is that you can how to save lots of money fast actually just have one image of the object you wish how to save lots of money fast to detect, and then have a few thousand negative images. Yes, a few thousand. The negative images can be anything, except they cannot contain your object.

From here, with your single positive image, you can use the opencv_createsamples command to actually create a how to save lots of money fast bunch of positive examples, using your negative images. Your positive image will be superimposed on these negatives, and it will be angled and all sorts of things. It actually can work pretty well, especially if you are really just looking for one specific how to save lots of money fast object. If you are looking to identify all screwdrivers, however, you will want to have thousands of unique images of how to save lots of money fast screwdrivers, rather than using the opencv_createsamples to generate samples for you. We’ll keep it simple and just use one positive image, and then create a bunch of samples with our negatives.

Ok great, getting a positive image is no problem! There is just one problem. We need thousands of negative images. Possibly in the future, we may want thousands of positive images too. Where in the world can we do that? There’s quite a useful site, based on the concept of wordnet, called imagenet. From here, you can find images of just about anything. In our case, we want watches, so search for watches, and you will find tons of categories of watches. Let’s go with analog watches. Awesome! It gets better though. Check out that downloads tab! There’s a URL for all of the analog watches!. Very cool. Okay but I said we will just use the one how to save lots of money fast positive, so we just detect the one watch. If you want to detect "all" watches, prepare to get more like 50,000 images of watches, and at least 25,000 "negative" images. After that, prepare to have quite the server, unless you want your haar cascade training to take a how to save lots of money fast week. So how might we get negatives? The whole point of imagenet is for image training, so their images are pretty specific. Thus, if we search for people, cars, boats, planes…Whatever, chances are, there will be not watches. You might see some watches on people or something like how to save lots of money fast that, but you get the idea. Since you will likely find watches around or on people, I actually think you might as well get images of how to save lots of money fast people. My idea was to find people doing sports, they probably are not wearing analog watches. So, let’s find some bulk image URL links. I found the sports/athletics link to have a reported 1,888 images, but you will find a lot of these are totally how to save lots of money fast broken. Let’s find one more: people.

Alright great, we have all these images, now what? Well, first, we actually want all of these to be the same how to save lots of money fast size, and a whole lot smaller! Gosh if only we knew of a way to manipulate how to save lots of money fast images… Hmm… Oh right this is an opencv tutorial! We can probably handle it. So, first, what we’re going to do here is write a quick script how to save lots of money fast that will visit these URL lists, grab the links, visit the links, pull the images, resize them, save them, and repeat until we’re done. When our directories are full of images, we also need a sort of description file that describes how to save lots of money fast the images. For positives, this file is a massive pain to create manually, since you need to specify the exact region of interest how to save lots of money fast for your object, per image. Gross. Luckily the create_samples method places the image randomly and does how to save lots of money fast all that work for us. We just need a simple descriptor for the negatives, but that’s no problem, we can do that while we pull and manipulate the how to save lots of money fast images.

What this does is creates samples, based on the img we specifiy, bg is the background information, info where we will put the info.List output (which is a lot like the bg.Txt file), then the -pngoutput is wherever we want to place the newly generated how to save lots of money fast images. Finally, we have some optional parameters to make our original image how to save lots of money fast a bit more dynamic and then =num for the number of samples we want to try how to save lots of money fast to create. Great, let’s run that. Now you should have ~2,000 images in your info directory, and a file called info.Lst. This file is your "positives" file basically. Open that up and peak at how it looks:

Kind of hard to see it, but the watch is in this image if you look how to save lots of money fast hard. Lower and to the left of the left-most person in the image. Thus, this is a "positive" image, created from an otherwise "negative" image, and that negative image will also be used in training. Now that we have positive images, we now need to create the vector file, which is basically where we stitch all of our positive how to save lots of money fast images together. We will actually be using opencv_createsamples again for this!

There are more options, but these will do. The main ones here are the numbers of positive and how to save lots of money fast negatives. General concensus is, for most practices, you want to have 2:1 ratio of pos:neg images. Some situations may differ, but this is a general rule people seem to follow. When in rome. Next, we have stages. We chose 10. You want 10-20 at least here, the more, the longer it will take, and it is again exponential. The first stage is pretty fast usually, stage 5 much slower, and stage 50 is forever! So, we do 10 stages for now. The neat thing here is you can train 10 stages, come back later, change the number to 20, and pick up right where you left off. Similarly, you can just put in something like 100 stages, go to bed, wake up in the morning, stop it, see how far you got, then "train" with that many stages and you will be instantly presented how to save lots of money fast with a cascade file. As you can probably gather from that last sentence, the result of this command is indeed the great, and holy, cascade file. Ours will hopefully detect my watch, or whatever object you decided to go with. All I know is that I am not even through how to save lots of money fast with stage 1 yet from typing this entire paragraph. If you really do want to run the command overnight, but don’t want to leave the terminal open, you can make use of nohup:

10 stages took a bit less than 2 hours to how to save lots of money fast do on my 2GB digital ocean server. So, either you have a cascade.Xml file, or you stopped the script from running. If you stopped it from running, you should have a bunch of stagex.Xml files in your "data" directory. Open that up, see how many stages you did, and then you can run the opencv_traincascade again, with that number of stages, and you will be immediately given a cascade.Xml file. From here, I like to just name it what it is, and how many stages. For me, I did 10 stages, so I am renaming it watchcascade10stage.Xml. That’s all we need, so now head back to your main computer with your how to save lots of money fast new cascade file, put it in your working directory, and let’s try it out! Import numpy as np

As you probably noticed, the boxes for the watch is pretty small. It doesn’t seem to get the entire watch. Recall our training size was 20×20. Thus, we have a 20×20 box at most. You could do 100×100, but, beware, this will take a very long time to train. Thus, rather than drawing a box, why not just write text over the watch or something? Doing this is relatively simple. Rather than doing cv2.Rectangle(img,(x,y),(x+w,y+h),(0,0,255),2) in watches, we can do font = cv2.FONT_HERSHEY_SIMPLEX

I do not know about you, but once I finally got this working, I was very excited! The most impressive thing to me is the size of how to save lots of money fast the data required to track objects. Haar cascades tend to be anything from 100-2,000 KB in size. A 2,000 KB haar cascade is either too big, or it should be very accurate. Consider in your day you probably come across ~5,000 general objects. Consider the average haar cascade is ~ 500 KB maybe. This gives us: 0.5 MB * 5,000 = 2,500 MB, or 2.5 GB. This gives you 2.5 GB of ram needed to recognize 5,000 objects, and probably most objects you will ever come across in how to save lots of money fast a day. This fascinates me. Consider we have access to all of image-net, and can pull general images for a wide range of how to save lots of money fast objects immediately. Consider further than most of the images on imagenet are how to save lots of money fast basically 100% of the "tracking" object, thus you can probably get by in the positives by how to save lots of money fast not manually noting location and just using 0,0 and the full size of the image. The possibilities for what you can do here are massive… Well, that’s all for now. I will likely do some character recognition with opencv in how to save lots of money fast the future. If you have any other requests, email me, suggest in the community, or post on the videos.

RELATED_POSTS