fabiocarrara / deep-parking

Code to reproduce 'Deep Learning for Decentralized Parking Lot Occupancy Detection' paper.
http://cnrpark.it
99 stars 45 forks source link

an example for config.py #3

Closed amiltonwong closed 6 years ago

amiltonwong commented 6 years ago

Hi, @fabiocarrara

As from README.md, config.py is required to placed inside each folder in splits/. Are the contents of config.py the same as this one?

Could you give a complete example for config.py?

THX!

fabiocarrara commented 6 years ago

Yes. An example of config.py file could be the following:

config = dict(root_folder = '/path/to/CNR-EXT-Patches-150x150/PATCHES/')

In general, root_folder is prepended to the URLs listed in the txt files defining the splits (e.g. camera1.txt). Just make sure that the contatenation results in the correct absolute path of the images.

amiltonwong commented 6 years ago

Hi, @fabiocarrara ,

Thanks for your reply. I had appended config.py inside each folder in splits/.
/data/code4/deep-parking/splits/PKLot/config.py /data/code4/deep-parking/splits/CNRParkAB/config.py /data/code4/deep-parking/splits/CNRPark-EXT/config.py

However, I still got the following error after I run main.py:

(py2.7_caffe) root@milton-ThinkCentre-M93p:/data/code4/deep-parking# python main.py 
INFO 2018-05-13 20:53:32: Setting up mAlexNet trained on PKLot_train, validated on PKLot_val, CNRPark-EXT_val, tested on PKLot_test_CNRPark-EXT_test ...
sh: 1: /opt/caffe/python/draw_net.py: not found
INFO 2018-05-13 20:53:32: Training on PKLot_train while validating on PKLot_val, CNRPark-EXT_val ...
Traceback (most recent call last):
  File "main.py", line 100, in <module>
    exp.run(plot=False) # run without live plot
  File "/data/code4/deep-parking/pyffe/experiment.py", line 42, in decorator
    return function(*args, **kwargs)
  File "/data/code4/deep-parking/pyffe/experiment.py", line 399, in run
    caffe = subprocess.Popen(cmd, stderr=subprocess.PIPE)
  File "/root/anaconda2/envs/py2.7_caffe/lib/python2.7/subprocess.py", line 390, in __init__
    errread, errwrite)
  File "/root/anaconda2/envs/py2.7_caffe/lib/python2.7/subprocess.py", line 1025, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

Moreover, for splits/Combined , how should I modify its config.py as Combined refers to both of CNRParkAB and CNRPark-EXT? CNRParkAB and CNRPark-EXT locate in two different directories? e.g. /data/code4/deep-parking/dataset/CNRPark-Patches-150x150/ for CNRParkAB and /data/code4/deep-parking/dataset/CNR-EXT-Patches-150x150/PATCHES/ for CNRPark-EXT.

THX!

fabiocarrara commented 6 years ago

The code assumes that the caffe root directory is /opt/caffe. This is a current limitation (and not the only one) of pyffe. You should change the hardcoded path in pyffe/experiment.py to match your caffe installation.

About the Combined dataset, I suggest you to create a new directory (e.g. CNRParkAB_EXT) containing symlinks to the 5 different subsets. You should have something like this:

CNRParkAB_EXT
CNRParkAB_EXT/A
CNRParkAB_EXT/B
CNRParkAB_EXT/OVERCAST
CNRParkAB_EXT/SUNNY
CNRParkAB_EXT/RAINY

where A, B, OVERCAST, SUNNY, RAINY are symlinks to the folders extracted from the tar archives. Then you should be able to use path/to/CNRParkAB_EXT/ as root_folder in config.py.