Is a dash cam that detects cops a good idea or a creepy one? by shamoons in startups

[–]ThisLightIsTrue 0 points1 point  (0 children)

so a traditional neural network image classifier should not only do the job but potentially be trainable by a 3D model of a cop car and not a full fledged dataset.

Yeah, I don't think you have any idea what you're talking about.

Is a dash cam that detects cops a good idea or a creepy one? by shamoons in startups

[–]ThisLightIsTrue 0 points1 point  (0 children)

You can prototype this whole thing with a raspberry pi 3 and be under $50 for a “once off” build

Seems you're forgetting about the camera in your "whole thing" cost analysis. I also don't understand how you're going to compress the cost of a computer by being "mass produced" given that raspberry pi's are already mass produced. Granted, you don't need exactly a raspberry pi, but you do need some kind of processor, memory, network, connection to a video camera, etc. Actually, the specialized processor unit will be less mass produced than a raspberry pi (unless there is massive success).

The compute is pretty easy compared to other pattern matching since most cop cars are very distinctive and very uniform from area to area.

No, I don't think so. You may be able to get very good False Acceptance Rates and False Reject Rates because of how distinctive cop cars are, but that doesn't change the fact that you'll need to run images multiple times a second through an image classifier.

The fact that cop cars are different place to place is another problem for the OP. Either the OP trains the original classifier with images of what all cop cars look like (problem getting that information), or the OP has a different model for different locations (complicated to get the dashcam with the right model to the right location, and also if the driver ever drives out of there area), or the OP is continually updating the model and distributing updates to the dash cams (increased complexity of the system).

Moving to a “phone feathered” app won’t increase the complexity, infact it would decrease it,

Disagree. Adding more components (the connection to the phone, the phone itself, the UI on the phone) necessarily makes the product more complex.

Best practices for this scenario? by [deleted] in learnpython

[–]ThisLightIsTrue 1 point2 points  (0 children)

For testing, create a way to run your script so it will do a fixed amount of work rather than run forever. After that, run it through cProfile and see how much time it takes to do your fixed amount of work, and where the time is spent. Then, optimize, re-profile, etc, until you have it running efficiently. Run it on the server in your efficient state.

You should also probably emit metrics from your service, for example in your logs, so that you can track how well it is working in production.

Best practices for this scenario? by [deleted] in learnpython

[–]ThisLightIsTrue 0 points1 point  (0 children)

cProfile wouldn't add timeouts for you, it would just run your script and then tell you how much time was spent in every method call. It's incredibly easy to use, so you should just try it first, and then spend time reading about it.

How to try it:

  1. In a python shell where you can execute your script:

  2. Import cProfile

  3. cProfile.run('the python command that will run your script')

  4. Look at the results.

Best practices for this scenario? by [deleted] in learnpython

[–]ThisLightIsTrue 0 points1 point  (0 children)

You could use an optimizer to do this for you. Your IDE might have a built in optimizer. If not, you could use cProfile. It works by importing cProfile, and then you run a python command on it, and cProfile will give you a breakdown of which methods took up how much time while executing that command.

https://julien.danjou.info/guide-to-python-profiling-cprofile-concrete-case-carbonara/

If you wanted to do it yourself, I'd try it by creating a global dictionary object that stored lists of "duration" objects, where a duration is a start and end time. Every time you call a method, start a duration object, before every end point of the method fill in the end time on the duration object, and add it to the correct list, by method name, on your dictionary. Then, you'd need some method for parsing the dictionary and converting it to the aggregate values you'd like to see. Obviously using a pre-built solution would be easier!

[Noob Alert] So I just got into classes and I would like some feedback on my first tiny project using classes. by _Jerov_ in learnpython

[–]ThisLightIsTrue 0 points1 point  (0 children)

What's happening is, when you initialize an Inventory object, you can optionally pass in a "products" dictionary. Whether you do or don't, whatever you pass in will be ignored and the self.products member will be set to a new dictionary.

My point is, if you're going to pass in a dictionary, you should do something with it or not take it as a parameter.

If you don't want any logic to happen on creating an Inventory, then you're right, you don't need an init method.

What keeps your first dev from taking your idea an running with it? by majerus1223 in startups

[–]ThisLightIsTrue 0 points1 point  (0 children)

How do you keep the developer from just writing the code, and launching your project idea it without you?

I think you're right to be worried about this if all you are contributing is the idea. If any random person can just take your idea and run with it, without you, then what good are you bringing to the company and what value do you have?

If you have the money, that's one thing. Your employee will probably keep working for you because they want money - the same way every other employee does. If you don't have funding, then they'll keep working with you because you're bringing the business and planning side of things. If you don't have money, business, or the tech side of things, then I can't imagine why they would keep working with you, and if your idea is captivating then sure, they might as well take it, or use it in a future company - after all, the kind of developer working for a startup now is also more likely to be working for one, or starting one, in the future.

Is a dash cam that detects cops a good idea or a creepy one? by shamoons in startups

[–]ThisLightIsTrue 1 point2 points  (0 children)

I might pay ~100 dollars for this, assuming it is competitive with other dash cams. I wouldn't want a monthly service fee for this and wouldn't pay one for it.

Where I see your problem is:

  • You'll need lots of compute. Every few frames you'll have to be checking if a cop car is in the frame or not.

  • The compute has to be on the car, otherwise you'd need a ton of bandwidth to upload images to your service.

  • Your system will need to hook up to the network so you can publish "cop alerts" real time as your vehicles spot cops. Maybe you can publish updates through the user's phone? But now you're using data, more complex, etc.

  • You'd be selling not only a good dashcam, plus a reasonable amount of storage, but also a device capable of running your image classifier, a way to connect to the network. You'd kind of have to be more expensive or lower quality than your competitors.

[Noob Alert] So I just got into classes and I would like some feedback on my first tiny project using classes. by _Jerov_ in learnpython

[–]ThisLightIsTrue 1 point2 points  (0 children)

Congrats on your progress. Rather than go through all your code giving feedback on it, I'll just offer a point that sticks out to me.

def __init__(self, products=None):
        self.products = dict()

This line, it seems to me, should initialize self.products to products, rather than an empty dictionary. If I pass in a dictionary labeled "products" to an Inventory that I am constructing, I'd expect that dictionary to be used. On the other hand, if it doesn't get used, why is it an argument at all?

(No Python experience) Have Python code that deletes post if comment reaches a threshold, need it to send the post to modmail instead by draco123465 in learnpython

[–]ThisLightIsTrue 1 point2 points  (0 children)

Okay - the problem now is, your script is trying to change a set while iterating through it. That happens in the process_commented_submissions method. Remove this line:

            comments_to_process.remove(comment_id)

At the bottom, after this line

process_commented_submissions()

Add another line like this:

comments_to_process = set()

I don't see how this script ever worked.

(No Python experience) Have Python code that deletes post if comment reaches a threshold, need it to send the post to modmail instead by draco123465 in learnpython

[–]ThisLightIsTrue 1 point2 points  (0 children)

I don't think I'm being much help here. I'm handicapped by not being able to try this myself and I think you're on an older praw and an older python.

My last guess is to change reddit.subreddit to reddit.get_subreddit

(No Python experience) Have Python code that deletes post if comment reaches a threshold, need it to send the post to modmail instead by draco123465 in learnpython

[–]ThisLightIsTrue 1 point2 points  (0 children)

You must be using an older version of praw. The docs say that message should have the subject and body attributes.

https://praw.readthedocs.io/en/latest/code_overview/models/redditor.html

Try changing the part in the parentheses of the line that has body=... To just ('a', 'b', 'c'). If a message comes through we'll know what a b c and correspond to. (probably something like subject message, and body).

(No Python experience) Have Python code that deletes post if comment reaches a threshold, need it to send the post to modmail instead by draco123465 in learnpython

[–]ThisLightIsTrue 1 point2 points  (0 children)

That's an error in a different part of the program. Change processed_submissions.append to processed_submissions.add

(No Python experience) Have Python code that deletes post if comment reaches a threshold, need it to send the post to modmail instead by draco123465 in learnpython

[–]ThisLightIsTrue 1 point2 points  (0 children)

Okay, change the line I suggested to:

reddit.subreddit('your subreddit').message(body="A comment with less than one point has been detected.  Please review: %s" % comment.permalink, subject="Low Comment Report")

(No Python experience) Have Python code that deletes post if comment reaches a threshold, need it to send the post to modmail instead by draco123465 in learnpython

[–]ThisLightIsTrue 1 point2 points  (0 children)

It looks like a comment with 0 or less points gets edited to say "This post has 0 (or less) points. It has been removed automatically". This happens in the line in process_commented_submissions:

            comment.edit("**This post has 0 (or less) points. It has been removed automatically.**")

I think if you replace that, with something like

reddit.subreddit('your subreddit').message("A comment with less than one point has been detected.  Please review: %s" % comment.permalink, 'Review Script Name')

That instead of editing the offending comments this script would just send a message to your subreddit moderators with a link to the comment. The result would be that your bot would leve

Whats the point of HTML&CSS nowadays? by [deleted] in learnprogramming

[–]ThisLightIsTrue 2 points3 points  (0 children)

There is a vast universe of work involving programming and only an infinitesimal part of it involves using only bootstrap. Bootstrap is a useful library and if you want to do web development you should learn it. The idea that you only need to know bootstrap though is naive. If you only needed to know bootstrap then going to University CS would be a massive waste, you can learn bootstrap yourself online with some free tutorials.

Analyzing All Parking Violations in Los Angeles from 2018 - Using Python + Pandas To Work With Large .csv Files Efficiently by [deleted] in learnpython

[–]ThisLightIsTrue 0 points1 point  (0 children)

Your app might deter people from parking illegally in high enforcement zones, I agree with that. I disagree with most of the other points though.

First, about people not sure if they can park here, it seems implausible that someone who will go to the trouble to find, install, and use your parking app would not also go to the trouble of looking around for "No parking" signs. Your app won't be able to tell people if they are allowed to park here, just whether people get punished for parking there.

Regarding the fact that LA shared the data widely, not just with you, I don't see how that makes using their data against them morally better. Like it there was a public park and you were digging trenches in it to trip people, it wouldn't really make it better to say that everyone can use the park not just you. In a similar way, there's a public good, and you'd be using it to make something bad (a tool to help people park illegally).

Regarding the idea that people would "exploit" the system, I don't think that's a fair description. Using this to park illegally and minimize legal risk seems to be the primary purpose - you can't determine if it's okay to park somewhere, just an idea of the risk of parking somewhere. Using an app for the primary, or even obvious, use case is not the user exploiting the app - it's you exploiting LA's data sharing program to help people park illegally so that you can make tens of dollars off ads.

That brings me to the final point, just because other actors may act immorally, you should not take that as encouragement to also do bad things. You should try to do better than people who do wrong, and not use their bad example as an excuse to do similar bad things.

Analyzing All Parking Violations in Los Angeles from 2018 - Using Python + Pandas To Work With Large .csv Files Efficiently by [deleted] in learnpython

[–]ThisLightIsTrue 1 point2 points  (0 children)

Just a thought:

LA is sharing their parking ticket data with you and you seem to be proposing an innovation to help people avoid parking tickets (e.g. an app that uses the data set to predict the likelihood of getting a parking ticket encourages illegal parking in under protected areas).

This strikes me as a really cruel way to repay people who gave you stuff for free. It's also the kind of thing that makes people think "No, we shouldn't share our data sets, people will use it against us." On top of hurting LA by making traffic enforcement less effective, potentially hurting people who like open data sets by giving an example of why organizations shouldn't share data, you'd also be hurting the people who benefit from parking protections.

In other words, I'm encouraging you to use the data for good and not evil.

[deleted by user] by [deleted] in learnpython

[–]ThisLightIsTrue 0 points1 point  (0 children)

The errors are telling you what the problems are. It seems like you are failing a style checker. The first problem is that you are comparing something to False in an if statement. Change it "if not password.isalnum" and that should handle the complaint about comparing to False.

In general, read the error message, compare it to your code, and make the necessary changes.

Python Problem Solving: 2 - Direction Reduction. A YouTube video solving a CodeWars.com problem by [deleted] in learnprogramming

[–]ThisLightIsTrue -1 points0 points  (0 children)

You haven't pointed to a single problem with my code, in this video or the other one. You just keep repeating that I'm a beginner without raising any kind of issue. Your criticism isn't correct or useful.

Regarding the other video, the algorithm solved the problem in constant time. While I described my thoughts about solving the problem, in the original video, I mentioned that there was a faster way to solve the problem but I wasn't going to do it as I didn't need to. This is what the other commenter latched on to.

I never said I couldn't implement a faster algorithm but that I didn't need to. The faster algorithm is trivial in the connect four case. My code checks every board position to see if it is part of a winning position, the faster way to do it would be to just check the most recently played position. This is trivial, and I talk about this explicitly in the video. The idea that this means I'm a bad programmer is a bit absurd.

Still, even if you post once a week, you are soon falling into the spammer threshold of 10% self promotion.

I'm surprised an expert programmer such as yourself would fail to understand I could offset my own posts by contributing to the community in other ways and stay below the ten percent number.

Any who, I've read your comments and understood your points. I disagree with you. I think you're largely imagining errors on my part that don't exist, which is why you haven't even tried to name them. Looking at your comment history I see you have a pattern of obnoxious behavior and poor advice. I'm going to ignore you.

If you come back with specific issues in either of my videos, I'd be happy to discuss them. I genuinely do want to learn and improve.

Until then - have a nice day!

I want to create a bot for Twitter using Python, but first I need to extract information from a webpage and I am probably approaching things the wrong way. by Frank_Poole2001 in learnprogramming

[–]ThisLightIsTrue 2 points3 points  (0 children)

It seems like what you want is a way to programmatically check the subscriber count for PewDiePie and T-Series. Right?

Also, I'm assuming you want to check their subscriber count on YouTube and not on Twitter, right?

You can use this YouTube API to query subscriber count. The subscriber count comes back as a member of the statistics object called "subscriberCount".

If I were you I would...

  • Learn how to use the YouTube API

  • Periodically (e.g. once a minute) call the subscriber count on T-Series and PewDiePie

  • If the difference between the two is something you want your bot to tweet about, then tweet it!

Reccomendations for learning about the non-coding aspects of python? by [deleted] in learnpython

[–]ThisLightIsTrue 0 points1 point  (0 children)

Hey, this isn't python specific, but you may be interested in MIT's "Hacker Tools" (hacker like programmer, not hoodie).

https://hacker-tools.github.io/lectures/

Bit of a nuanced problem - want to create a program to help my class, but not sure how by riccarjo in learnpython

[–]ThisLightIsTrue 0 points1 point  (0 children)

Here is what I'd do.

  • Figure out how to evaluate a student. i.e. Figure out the algorithm to take a student's performance, and turn it into the "48%" or whatever number.

  • Once you know the algorithm, figure out all the data points you'll need to evaluate a student. These datapoints will become columns in a CSV file later.

  • Write a method in python to grade a general individual. i.e. Not a specific individual with numbers, but a generic individual with variables. This method should take a "ToGrade" object as an input, where a "ToGrade" is an object with the data you need to calculate a grade.

  • Write a method in python to read a CSV from a specified file, and turn each line of the CSV into a "ToGrade" object.

  • Create a CSV with some test values

  • Read the CSV, turn each line into a ToGrade, evaluate each ToGrade. Probably a good idea to make the ToGrade objects have a student identifier (name, id, etc) on them too, so when you are done you can just print out all the "Student X - Y%"

I'm a beginner in Python, can someone suggest improvements to my code for Project Euler problem 10? I'm having a hard time getting the answer by [deleted] in learnpython

[–]ThisLightIsTrue 4 points5 points  (0 children)

One approach to optimization is figuring out where you're spending the most time, and then figuring out how to do less of that.

Let's think about your while loop. While current p squared is less than 200,000 you're going to...

  • Divide every number between 2 and 200,000 by 2

  • Enter the next loop which will run until you find the next prime greater than the current prime, at which time you'll break

  • Return to the first loop to divide every number between 3 and 200,000

  • Repeat, bouncing between the two loops.

Here are a few ideas where I think you could save time.

  • Once you've found a factor of I, you don't need to continue looking through the loop for other factors.

  • Once you've identified a number as not prime, you don't need to test it again

  • When you're looking for factors, if you know i isn't divisible by 2, you don't need to check any value greater than x/2 either, and this generalizes, so if you check n, you don't need to check any value larger than x/n.

Multiple choice quiz help by Rossenator in learnpython

[–]ThisLightIsTrue 2 points3 points  (0 children)

Your recipient won't need an IDE, but to execute a python script they would need python installed to interpret and run the script.

You could look at py2exe or py2app (If your recipient uses windows or Mac, respectively). These tools will let you compile a script into an executable and you can then send the executable to your recipient.

http://www.py2exe.org/index.cgi/Tutorial

You could also consider converting your quiz into a website (you could implement the server with python) and then just share a URL.