Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.

create_list.py json file dump problem

Cagri_T_Intel
Employee
548 Views

 

Hi,

I was trying to get the "smart_classroom_sample" working.

According to the instructions here, the user needs to provide a set of face images as references for the person identification. Then the create_list.py script listed under \inference_engine\samples\smart_classroom_sample needs to be run to create a file called faces_gallery.json.

I observed that the *.json file was not created even though the script seemed top work as expected. When I debugged the script a bit more, I noticed that the json dump was not working due to a path error for some reason (I don't actually know why it does not work)

I modified the end of the script as follows which creates the json file in the same folder as the create_list.py script (which I think was the intention)

scriptFilePath = os.path.realpath(__file__)   # this returns the full file path
scriptPath = os.path.dirname(os.path.abspath(scriptFilePath))  # this removes the file name from the path

with open(scriptPath + '\\faces_gallery.json', 'w') as outfile:
    json.dump(objects, outfile)

I hope the above will be useful for anyone who came across the same problem.

Regards...

0 Kudos
2 Replies
Monique_J_Intel
Employee
548 Views

Hi Charaw,

There shouldn't be any issues with generating the files other than permissions on creation of the file. I've tested this in the root directory where sudo was needed and in the home directory where sudo wasn't needed and both test generated the .json file. What directory are you calling the create_list.py from?

Kind Regards,

Monique Jones

0 Kudos
Cagri_T_Intel
Employee
548 Views

 

Hi Monique,

Thanks for your message. I am a Windows user therefore sudo does not apply in my particular case.

I tried to run the script via Windows command prompt (with and without admin privileges) while under \inference_engine\samples\smart_classroom_sample and this did not work. It appears that the json dump needs the absolute path to work.

Regards...

0 Kudos
Reply