I have a final year project in Artificial intelligence and I need to make a facial recognition project. I'm confused how to start this project and how plagiarism works in terms of coding? No one would make a project from scratch but the thing is my coding ability in python is very limited and the code that I have seen for facial recognition using the K nearest algorithm is like 70 lines. If I change that code with my variable names and create functions and add that code into those functions would that be a problem ? what do I do ? I would obviously cite where I got this code from and say that my code is inspired from this. But if i just change the variables and make a few functions and add their code clearly I have done very little work in terms of coding aspect.
If I change that code with my variable names and create functions and add that code into those functions would that be a problem ?
That seems like blatant plagiarism: Taking code and changing variable names surely only serves plagiarism. Creating new functions from existing code surely only serves plagiarism too.
what do I do ?
Use as much external code as you like. That code should appear as-is, with any ownership, copyright, and licensing information intacted, where ownership information is missing, perhaps add it, at the very least, document the fact that code isn't yours.
Write your own code that uses external code. That's your contribution.
Occasionally, you may use an external code snippet within your code. Mark such code with comments, e.g.,
/** BEGIN: Code from xyz **/ and
/** END **/.
Ultimately, your goal should be to achieve your objective with minimal code.
When I saw your question, I was rather concerned. No-one should be asking how little they need to do in order to pass their final year project!
However, having read the content of your question it sounds as if you are not actually trying to get away with doing minimal work, just feeling stuck and trying to find a way to improve your project.
You already know that you need to cite your code - any attempt to pass off code written by others as your own would be an act of plagiarism, and as such would be subject to the penalties employed at your college. It's therefore very important that it's VERY clear which elements of the code are your own work, which you have adapted from another source, and which are entirely replicated from another source, and that those sources are clearly and appropriately referenced. You can find guides about how to reference code online, but it’s likely your local library or learning resource center would also provide guides about this.
Depending on the purpose of your code in relation to your whole project, your project may also benefit from a justification as to why you have utilized code from other (cited) sources rather than write your own. The approach you take to do this may be different where you are including external packages/modules rather than including code directly.
If I was supervising your final year project the first thing I would recommend doing is to look again at the scope of your task. If your project simply requires the reproduction of code already written by others just to see if you can get it to work, then its scope is very limited. Maybe you need to expand the scope and/or aim of your project to ensure you are developing something specific to a clear project aim. I’d therefore suggest you note some ideas about how your project could be expanded then use that as a starter for discussion in your next supervisor meeting. This would show you are proactive in developing your project scope (and not asking them to tell you what to do, which wouldn’t be appropriate in the final year) and hopefully also enable you to improve your project into being something you can be proud to include in your portfolio of work once it’s complete :)
I would recommend to look at the actual (discrete) mathematics and write your corresponding code from scratch.
You say it's only 80 SLOC, so why not implement it yourself? If you make use of established libraries, well, this is fine IMHO usually. Ask your advisor, if you are supposed to not use libraries/frameworks before.