nicholaskajoh / ivy

Video-based object counting software.
MIT License
428 stars 170 forks source link

TypeError: expected str, bytes or os.PathLike object, not NoneType #37

Closed byq-luo closed 4 years ago

byq-luo commented 4 years ago

TypeError: expected str, bytes or os.PathLike object, not NoneType

(ivy) PS C:\Users\Administrator\ivy> python main.py Traceback (most recent call last): File "main.py", line 143, in init_logger() File "C:\Users\Administrator\ivy\util\logger.py", line 55, in init_logger pathlib.Path(log_files_directory).mkdir(parents=True, exist_ok=True) File "D:\ProgramData\Anaconda3\envs\ivy\lib\pathlib.py", line 983, in new self = cls._from_parts(args, init=False) File "D:\ProgramData\Anaconda3\envs\ivy\lib\pathlib.py", line 640, in _from_parts drv, root, parts = self._parse_args(args) File "D:\ProgramData\Anaconda3\envs\ivy\lib\pathlib.py", line 624, in _parse_args a = os.fspath(a) TypeError: expected str, bytes or os.PathLike object, not NoneType

nicholaskajoh commented 4 years ago

EDIT: See next comment. Try that out first.

Hello @byq-luo! What's your LOG_FILES_DIRECTORY? Since you're on Windows, you might need to change it to something like LOG_FILES_DIRECTORY="C:\Users\Administrator\ivy\data\logs". Same goes for all other paths in your .env file.

Please try this out and get back to me.

Cheers!

nicholaskajoh commented 4 years ago

I just noticed you tried running the program with python main.py. Use python -m main instead. That might fix your issue.

byq-luo commented 4 years ago

I just noticed you tried running the program with python main.py. Use python -m main instead. That might fix your issue.

Using python -m main it has the same problem.

byq-luo commented 4 years ago

EDIT: See next comment. Try that out first.

Hello @byq-luo! What's your LOG_FILES_DIRECTORY? Since you're on Windows, you might need to change it to something like LOG_FILES_DIRECTORY="C:\Users\Administrator\ivy\data\logs". Same goes for all other paths in your .env file. Please try this out and get back to me.

Cheers!

I'm a newbie, I don't understand LOG_FILES_DIRECTORY file, I try it with ubuntu.

byq-luo commented 4 years ago

EDIT: See next comment. Try that out first. Hello @byq-luo! What's your LOG_FILES_DIRECTORY? Since you're on Windows, you might need to change it to something like LOG_FILES_DIRECTORY="C:\Users\Administrator\ivy\data\logs". Same goes for all other paths in your .env file. Please try this out and get back to me. Cheers!

I'm a newbie, I don't understand LOG_FILES_DIRECTORY file, I try it with ubuntu.

I tried it(python -m main) with ubuntu and still the same problem. Seek guidance.

nicholaskajoh commented 4 years ago

LOG_FILES_DIRECTORY is an environment variable that specifies the folder where you want Ivy log files to be stored.

Did you create a .env file? If you haven't, please do so. See: https://github.com/nicholaskajoh/ivy/blob/master/.env.example.

byq-luo commented 4 years ago

LOG_FILES_DIRECTORY is an environment variable that specifies the folder where you want Ivy log files to be stored.

Did you create a .env file? If you haven't, please do so. See: https://github.com/nicholaskajoh/ivy/blob/master/.env.example.

I had create a .env file. (ivy) PS C:\Users\Administrator\ivy> python -m main Traceback (most recent call last): File "D:\ProgramData\Anaconda3\envs\ivy\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "D:\ProgramData\Anaconda3\envs\ivy\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\Administrator\ivy\main.py", line 143, in init_logger() File "C:\Users\Administrator\ivy\util\logger.py", line 55, in init_logger pathlib.Path(log_files_directory).mkdir(parents=True, exist_ok=True) File "D:\ProgramData\Anaconda3\envs\ivy\lib\pathlib.py", line 983, in new self = cls._from_parts(args, init=False) File "D:\ProgramData\Anaconda3\envs\ivy\lib\pathlib.py", line 640, in _from_parts drv, root, parts = self._parse_args(args) File "D:\ProgramData\Anaconda3\envs\ivy\lib\pathlib.py", line 624, in _parse_args a = os.fspath(a) TypeError: expected str, bytes or os.PathLike object, not NoneType

Absolute/relative path to video or camera input of traffic scene

E.g "./data/videos/sample_traffic_scene.mp4" or 1

VIDEO="C:/Users/Administrator/ivy/data/videos/sample_traffic_scene.mp4"

Specify if video capture is from a camera

IS_CAM=False

Specify a detection Region of Interest (ROI)

i.e a set of vertices that represent the area (polygon) where you want detections to be made

E.g [(750, 405), (1094, 398), (1569, 1028), (501, 1028)]

Default: [(0, 0), (frame_width, 0), (frame_width, frame_height), (0, frame_height)] (i.e the whole video frame)

DROI=[(750, 405), (1094, 398), (1569, 1028), (501, 1028)] USE_DROI=True SHOW_DROI=True # Display/overlay the detection ROI on the video

Maximum consecutive detection failures i.e number of detection failures

before it's concluded that an object is no longer in the frame

MCDF=2

Maximum consecutive tracking failures i.e number of tracking failures

before the tracker concludes the tracked object has left the frame

MCTF=3

Detection interval i.e number of frames before detection is carried out again

(in order to find new vehicles and update the trackers of old ones)

DI=10

Model/algorithm to use for vehicle detection (options: yolo, tfoda, haarcascade)

DETECTOR="yolo"

Enable GPU acceleration to get better performance

ENABLE_GPU_ACCELERATION=False

Algorithm to use for vehicle tracking (options: kcf, csrt)

TRACKER="kcf"

Record vehicle counting as video

RECORD=False

Set path where recorded video will be stored

OUTPUT_VIDEO_PATH="C:/Users/Administrator/ivy/data/videos/output.avi"

Run VCS without UI display

HEADLESS=False

Specify one or more counting lines

A counting line is represented by a label and line segment

E.g {'label': 'A', 'line': [(667, 713), (888, 713)]}

COUNTING_LINES=[{'label': 'A', 'line': [(667, 713), (888, 713)]}, {'label': 'B', 'line': [(1054, 866), (1423, 868)]}]

Configs for Haar Cascade detector

HAAR_CASCADE_PATH="C:/Users/Administrator/ivy/data/detectors/haarcascade/car.xml"

Configs for TFODA (Tensorflow Object Detection API) detector

TFODA_WEIGHTS_PATH="C:/Users/Administrator/ivy/data/detectors/tfoda/faster_rcnn_inception_v2_coco_2018_01_28.pb" TFODA_CONFIG_PATH="C:/Users/Administrator/ivy/data/detectors/tfoda/faster_rcnn_inception_v2_coco_2018_01_28.pbtxt" TFODA_CLASSES_PATH="C:/Users/Administrator/ivy/data/detectors/coco_classes.txt" TFODA_CLASSES_OF_INTEREST_PATH="C:/Users/Administrator/ivy/data/detectors/coco_classes_of_interest.txt" TFODA_CONFIDENCE_THRESHOLD=0.2

Configs for YOLO (You Only Look Once) detector

YOLO_WEIGHTS_PATH="C:/Users/Administrator/ivy/data/detectors/yolo/yolov3.weights" YOLO_CONFIG_PATH="C:/Users/Administrator/ivy/data/detectors/yolo/yolov3.cfg" YOLO_CLASSES_PATH="C:/Users/Administrator/ivy/data/detectors/coco_classes.txt" YOLO_CLASSES_OF_INTEREST_PATH="C:/Users/Administrator/ivy/data/detectors/coco_classes_of_interest.txt" YOLO_DATA_PATH="C:/Users/Administrator/ivy/data/detectors/coco.data" YOLO_CONFIDENCE_THRESHOLD=0.5

Log destinations

ENABLE_CONSOLE_LOGGER=True ENABLE_FILE_LOGGER=True ENABLE_LOGSTASH_LOGGER=False

Absolute/relative path to log files directory

LOG_FILES_DIRECTORY="C:/Users/Administrator/ivy/data/logs/"

Size of window used to view the vehicle counting process

DEBUG_WINDOW_SIZE=(858, 480)

nicholaskajoh commented 4 years ago

The environment variable LOG_FILES_DIRECTORY isn't set. That I know for sure. That's why you're getting the error you're getting. But I don't know why it isn't set. If you created a .env file in the root directory of the repo, it should pickup the variables from there. I'll need more information to be able to help you.

To confirm what I'm saying run...

set LOG_FILES_DIRECTORY "C:/Users/Administrator/ivy/data/logs/"
python -m main

You should get a different error from the one you're getting now.

byq-luo commented 4 years ago

The environment variable LOG_FILES_DIRECTORY isn't set. That I know for sure. That's why you're getting the error you're getting. But I don't know why it isn't set. If you created a .env file in the root directory of the repo, it should pickup the variables from there. I'll need more information to be able to help you.

To confirm what I'm saying run...

set LOG_FILES_DIRECTORY "C:/Users/Administrator/ivy/data/logs/"
python -m main

You should get a different error from the one you're getting now.

(ivy) PS C:\Users\Administrator\ivy> set LOG_FILES_DIRECTORY "C:/Users/Administrator/ivy/data/logs/" (ivy) PS C:\Users\Administrator\ivy> python -m main Traceback (most recent call last): File "D:\ProgramData\Anaconda3\envs\ivy\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "D:\ProgramData\Anaconda3\envs\ivy\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\Administrator\ivy\main.py", line 143, in init_logger() File "C:\Users\Administrator\ivy\util\logger.py", line 55, in init_logger pathlib.Path(log_files_directory).mkdir(parents=True, exist_ok=True) File "D:\ProgramData\Anaconda3\envs\ivy\lib\pathlib.py", line 983, in new self = cls._from_parts(args, init=False) File "D:\ProgramData\Anaconda3\envs\ivy\lib\pathlib.py", line 640, in _from_parts drv, root, parts = self._parse_args(args) File "D:\ProgramData\Anaconda3\envs\ivy\lib\pathlib.py", line 624, in _parse_args a = os.fspath(a) TypeError: expected str, bytes or os.PathLike object, not NoneType (ivy) PS C:\Users\Administrator\ivy>

nicholaskajoh commented 4 years ago

Hmm... this is weird. You know what? I'll get a Windows machine and try setting it up to see if I can reproduce this issue.

nicholaskajoh commented 4 years ago

I've tested on Mac and Linux, following the instructions in the readme. It works fine as expected. I'll try it out on Windows when I get access to a PC and get back to you.

byq-luo commented 4 years ago

But I've tested it on Ubuntu, and I'm still have the same errors.发自我的iPhone------------------ Original ------------------From: Nicholas Kajoh notifications@github.comDate: Mon,Jan 13,2020 5:57 PMTo: nicholaskajoh/ivy ivy@noreply.github.comCc: byq-luo luozb@chd.edu.cn, Mention mention@noreply.github.comSubject: Re: [nicholaskajoh/ivy] TypeError: expected str, bytes or os.PathLikeobject, not NoneType (#37)I've tested on Mac and Linux, following the instructions in the readme. It works fine as expected. I'll try it out on Windows when I get access to a PC and get back to you.

—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or unsubscribe. [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/nicholaskajoh/ivy/issues/37?email_source=notifications\u0026email_token=AM6ICUMXZIRYIW6ZQGZDZYTQ5Q3HLA5CNFSM4KEUMWQKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIYDKKQ#issuecomment-573584682", "url": "https://github.com/nicholaskajoh/ivy/issues/37?email_source=notifications\u0026email_token=AM6ICUMXZIRYIW6ZQGZDZYTQ5Q3HLA5CNFSM4KEUMWQKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIYDKKQ#issuecomment-573584682", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

nicholaskajoh commented 4 years ago

I believe you're missing an important step in the setup process. I've followed the instructions in the readme squarely and I was able to create a fresh setup without any problems. If you want me to put you through, send me an email and we can schedule a call.

I'm closing this issue for now because this is not a bug. Although I admit error handling could use some help and I'll be working on making errors as descriptive as possible.

Cheers!

byq-luo commented 4 years ago

I had sent my document to your gmai email yesterday. I don't know if you received it. My email is luozhongbin2015@gmail.com.发自我的iPhone------------------ Original ------------------From: Nicholas Kajoh notifications@github.comDate: Tue,Jan 14,2020 2:40 PMTo: nicholaskajoh/ivy ivy@noreply.github.comCc: byq-luo luozb@chd.edu.cn, Mention mention@noreply.github.comSubject: Re: [nicholaskajoh/ivy] TypeError: expected str, bytes or os.PathLikeobject, not NoneType (#37)Closed #37.

—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or unsubscribe. [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/nicholaskajoh/ivy/issues/37?email_source=notifications\u0026email_token=AM6ICUNVVHGSGL2VPSHYFV3Q5VM4DA5CNFSM4KEUMWQKYY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOV6LBG4Y#event-2945848179", "url": "https://github.com/nicholaskajoh/ivy/issues/37?email_source=notifications\u0026email_token=AM6ICUNVVHGSGL2VPSHYFV3Q5VM4DA5CNFSM4KEUMWQKYY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOV6LBG4Y#event-2945848179", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]