Hello. Wanko soba is a liberal arts student who attends a local public university.
In this article, I'll show you (as a reminder) how to run python from __cmd without having to rewrite it every time. By the way, this time we are dealing with .bat that __ batch file __.
In my case, of the module __Chainer Realtime Multi-Person Pose Estimator (hereinafter "CRMPE") __, centering on pose_detector.py, "Estimate the posture of the image of a person, and point and line. I wanted to repeat the content of "drawing and saving".
For university research (because the teacher is tolerant, please push your back even if the field deviates from the one in the laboratory) __ It became necessary to perform the same processing multiple times for a large amount of image data. That is the beginning of coding, which is called this article.
Like my case, I want to be able to repeat simple actions just by clicking __a specific file from the explorer (folder, etc.) screen! The batch file should work for those who say __.
rem this is to apply pose_detector.py to images
call C:\Users\name\anaconda3\Scripts\activate.bat
C:\Users\name\anaconda3\python.exe C:\Users\name\CRMPE\pose_detector.py posenet models/coco_posenet.npz --img data/sth.png
pause
exit
(2) Since python3 works under the anaconda environment (it seems to be true), I had to move the batch file "activate.bat" in the Scripts of anaconda3 first. If you just have python under the C drive regardless of anaconda or something, you can start from the next line.
③ Write python.exe, then __half-width space __ (which is unexpectedly forgotten), and then write __pose_detector.py that you want to move this time and the details of the instruction __. It should be kept in mind that the contents of this __batch file are almost clean and copied to cmd as it is __, so the details of this area are the same as I thought to write in cmd in advance. You can write it.
④ By writing pause, you can prevent __cmd from disappearing as soon as the result is output __ (You can keep cmd open until you enter some key). In my case, when printing the coordinate data (matrix) of the points in the image while outputting the image, I want to check if the added python code is working __, and observe it by writing a pause. Got time.
⑤ Finally, close cmd with exit.
For programs that require fine debugging, batch files will play a role (although this is fairly simple and easy). Also, I wanted to be able to use it better ... (because I can write for statements)
(Aspiration) Do your best in research, job hunting, and preparation for the hospital exam.
Recommended Posts