├── DAVIS
├── Annotations
│ └── 480p
│ │ └── car-shadow
│ │ ├── 00000.png
│ │ ├── 00001.png
│ │ ├── 00002.png
│ │ ├── 00003.png
│ │ ├── 00004.png
│ │ ├── 00005.png
│ │ ├── 00006.png
│ │ ├── 00007.png
│ │ ├── 00008.png
│ │ ├── 00009.png
│ │ ├── 00010.png
│ │ ├── 00011.png
│ │ ├── 00012.png
│ │ ├── 00013.png
│ │ ├── 00014.png
│ │ ├── 00015.png
│ │ ├── 00016.png
│ │ ├── 00017.png
│ │ ├── 00018.png
│ │ ├── 00019.png
│ │ ├── 00020.png
│ │ ├── 00021.png
│ │ ├── 00022.png
│ │ ├── 00023.png
│ │ ├── 00024.png
│ │ ├── 00025.png
│ │ ├── 00026.png
│ │ ├── 00027.png
│ │ ├── 00028.png
│ │ ├── 00029.png
│ │ ├── 00030.png
│ │ ├── 00031.png
│ │ ├── 00032.png
│ │ ├── 00033.png
│ │ ├── 00034.png
│ │ ├── 00035.png
│ │ ├── 00036.png
│ │ ├── 00037.png
│ │ ├── 00038.png
│ │ └── 00039.png
└── JPEGImages
│ └── 480p
│ └── car-shadow
│ ├── 00000.jpg
│ ├── 00001.jpg
│ ├── 00002.jpg
│ ├── 00003.jpg
│ ├── 00004.jpg
│ ├── 00005.jpg
│ ├── 00006.jpg
│ ├── 00007.jpg
│ ├── 00008.jpg
│ ├── 00009.jpg
│ ├── 00010.jpg
│ ├── 00011.jpg
│ ├── 00012.jpg
│ ├── 00013.jpg
│ ├── 00014.jpg
│ ├── 00015.jpg
│ ├── 00016.jpg
│ ├── 00017.jpg
│ ├── 00018.jpg
│ ├── 00019.jpg
│ ├── 00020.jpg
│ ├── 00021.jpg
│ ├── 00022.jpg
│ ├── 00023.jpg
│ ├── 00024.jpg
│ ├── 00025.jpg
│ ├── 00026.jpg
│ ├── 00027.jpg
│ ├── 00028.jpg
│ ├── 00029.jpg
│ ├── 00030.jpg
│ ├── 00031.jpg
│ ├── 00032.jpg
│ ├── 00033.jpg
│ ├── 00034.jpg
│ ├── 00035.jpg
│ ├── 00036.jpg
│ ├── 00037.jpg
│ ├── 00038.jpg
│ └── 00039.jpg
├── LICENSE
├── README.md
├── dataset.py
├── doc
└── ims
│ └── osvos.png
├── models
└── .gitignore
├── osvos.py
├── osvos_demo.py
├── osvos_parent_demo.py
├── requirements.txt
└── train_parent.txt
/DAVIS/Annotations/480p/car-shadow/00000.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00000.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00001.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00001.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00002.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00002.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00003.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00003.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00004.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00004.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00005.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00005.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00006.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00006.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00007.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00007.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00008.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00008.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00009.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00009.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00010.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00010.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00011.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00011.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00012.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00012.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00013.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00013.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00014.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00014.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00015.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00015.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00016.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00016.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00017.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00017.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00018.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00018.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00019.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00019.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00020.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00020.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00021.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00021.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00022.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00022.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00023.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00023.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00024.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00025.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00025.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00026.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00026.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00027.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00027.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00028.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00028.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00029.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00029.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00030.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00030.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00031.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00031.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00032.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00032.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00033.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00033.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00034.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00034.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00035.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00035.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00036.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00036.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00037.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00037.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00038.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00038.png
--------------------------------------------------------------------------------
/DAVIS/Annotations/480p/car-shadow/00039.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/Annotations/480p/car-shadow/00039.png
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00000.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00000.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00001.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00001.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00002.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00002.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00003.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00003.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00004.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00004.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00005.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00005.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00006.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00006.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00007.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00007.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00008.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00008.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00009.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00009.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00010.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00010.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00011.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00011.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00012.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00012.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00013.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00013.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00014.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00014.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00015.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00015.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00016.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00016.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00017.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00017.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00018.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00018.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00019.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00019.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00020.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00020.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00021.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00021.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00022.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00022.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00023.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00023.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00024.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00024.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00025.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00025.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00026.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00026.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00027.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00027.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00028.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00028.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00029.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00029.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00030.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00030.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00031.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00031.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00032.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00032.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00033.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00033.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00034.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00034.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00035.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00035.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00036.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00036.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00037.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00037.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00038.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00038.jpg
--------------------------------------------------------------------------------
/DAVIS/JPEGImages/480p/car-shadow/00039.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/DAVIS/JPEGImages/480p/car-shadow/00039.jpg
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # OSVOS: One-Shot Video Object Segmentation
2 | Check our [project page](http://www.vision.ee.ethz.ch/~cvlsegmentation/osvos) for additional information.
3 | 
4 |
5 | OSVOS is a method that tackles the task of semi-supervised video object segmentation. It is based on a fully-convolutional neural network architecture that is able to successively transfer generic semantic information, learned on ImageNet, to the task of foreground segmentation, and finally to learning the appearance of a single annotated object of the test sequence (hence one-shot). Experiments on DAVIS 2016 show that OSVOS is faster than currently available techniques and improves the state of the art by a significant margin (79.8% vs 68.0%).
6 |
7 |
8 | This TensorFlow code is a posteriori implementation of OSVOS and it does not contain the boundary snapping branch. The results published in the paper were obtained using the Caffe version that can be found at [OSVOS-caffe](https://github.com/kmaninis/OSVOS-caffe).
9 |
10 | #### NEW: PyTorch implementation also available: [OSVOS-PyTorch](https://github.com/kmaninis/OSVOS-PyTorch)!
11 |
12 | ### Installation:
13 | 1. Clone the OSVOS-TensorFlow repository
14 | ```Shell
15 | git clone https://github.com/scaelles/OSVOS-TensorFlow.git
16 | ```
17 | 2. Install if necessary the required dependencies:
18 |
19 | - Python 2.7, Python 3 (thanks to [@xoltar](https://github.com/xoltar))
20 | - Tensorflow r1.0 or higher (`pip install tensorflow-gpu`) along with standard [dependencies](https://www.tensorflow.org/install/install_linux)
21 | - Other python dependencies: PIL (Pillow version), numpy, scipy, matplotlib, six
22 |
23 | 3. Download the parent model from [here](https://data.vision.ee.ethz.ch/csergi/share/OSVOS/OSVOS_parent_model.zip) (55 MB) and unzip it under `models/` (It should create a folder named 'OSVOS_parent').
24 |
25 | 4. All the steps to re-train OSVOS are provided in this repository. In case you would like to test with the pre-trained models, you can download them from [here](https://data.vision.ee.ethz.ch/csergi/share/OSVOS/OSVOS_pre-trained_models.zip) (2.2GB) and unzip them under `models/` (It should create a folder for every model).
26 |
27 | ### Demo online training and testing
28 | 1. Edit in file `osvos_demo.py` the 'User defined parameters' (eg. gpu_id, train_model, etc).
29 |
30 | 2. Run `python osvos_demo.py`.
31 |
32 | It is possible to work with all sequences of DAVIS 2016 just by creating a soft link (`ln -s /path/to/DAVIS/ DAVIS`) in the root folder of the project.
33 |
34 | ### Training the parent network (optional)
35 | 1. All the training sequences of DAVIS 2016 are required to train the parent model, thus download it from [here](https://graphics.ethz.ch/Downloads/Data/Davis/DAVIS-data.zip) if you don't have it.
36 | 2. Place the dataset in this repository or create a soft link to it (`ln -s /path/to/DAVIS/ DAVIS`) if you have it somewhere else.
37 | 3. Download the VGG 16 model trained on Imagenet from the TF model zoo from [here](http://download.tensorflow.org/models/vgg_16_2016_08_28.tar.gz).
38 | 4. Place the vgg_16.ckpt file inside `models/`.
39 | 5. Edit the 'User defined parameters' (eg. gpu_id) in file `osvos_parent_demo.py`.
40 | 6. Run `python osvos_parent_demo.py`. This step takes 20 hours to train (Titan-X Pascal), and ~15GB for loading data and online data augmentation. Change dataset.py accordingly, to adjust to a less memory-intensive setup.
41 |
42 | Have a happy training!
43 |
44 | ### Citation:
45 | @Inproceedings{Cae+17,
46 | Title = {One-Shot Video Object Segmentation},
47 | Author = {S. Caelles and K.K. Maninis and J. Pont-Tuset and L. Leal-Taix\'e and D. Cremers and L. {Van Gool}},
48 | Booktitle = {Computer Vision and Pattern Recognition (CVPR)},
49 | Year = {2017}
50 | }
51 | If you encounter any problems with the code, want to report bugs, etc. please contact me at scaelles[at]vision[dot]ee[dot]ethz[dot]ch.
52 |
--------------------------------------------------------------------------------
/dataset.py:
--------------------------------------------------------------------------------
1 | """
2 | Sergi Caelles (scaelles@vision.ee.ethz.ch)
3 |
4 | This file is part of the OSVOS paper presented in:
5 | Sergi Caelles, Kevis-Kokitsi Maninis, Jordi Pont-Tuset, Laura Leal-Taixe, Daniel Cremers, Luc Van Gool
6 | One-Shot Video Object Segmentation
7 | CVPR 2017
8 | Please consider citing the paper if you use this code.
9 | """
10 | from PIL import Image
11 | import os
12 | import numpy as np
13 | import sys
14 |
15 |
16 | class Dataset:
17 | def __init__(self, train_list, test_list, database_root, store_memory=True, data_aug=False):
18 | """Initialize the Dataset object
19 | Args:
20 | train_list: TXT file or list with the paths of the images to use for training (Images must be between 0 and 255)
21 | test_list: TXT file or list with the paths of the images to use for testing (Images must be between 0 and 255)
22 | database_root: Path to the root of the Database
23 | store_memory: True stores all the training images, False loads at runtime the images
24 | Returns:
25 | """
26 | if not store_memory and data_aug:
27 | sys.stderr.write('Online data augmentation not supported when the data is not stored in memory!')
28 | sys.exit()
29 | # Define types of data augmentation
30 | data_aug_scales = [0.5, 0.8, 1]
31 | data_aug_flip = True
32 |
33 | # Load training images (path) and labels
34 | print('Started loading files...')
35 | if not isinstance(train_list, list) and train_list is not None:
36 | with open(train_list) as t:
37 | train_paths = t.readlines()
38 | elif isinstance(train_list, list):
39 | train_paths = train_list
40 | else:
41 | train_paths = []
42 | if not isinstance(test_list, list) and test_list is not None:
43 | with open(test_list) as t:
44 | test_paths = t.readlines()
45 | elif isinstance(test_list, list):
46 | test_paths = test_list
47 | else:
48 | test_paths = []
49 | self.images_train = []
50 | self.images_train_path = []
51 | self.labels_train = []
52 | self.labels_train_path = []
53 | for idx, line in enumerate(train_paths):
54 | if store_memory:
55 | img = Image.open(os.path.join(database_root, str(line.split()[0])))
56 | img.load()
57 | label = Image.open(os.path.join(database_root, str(line.split()[1])))
58 | label.load()
59 | label = label.split()[0]
60 | if data_aug:
61 | if idx == 0: sys.stdout.write('Performing the data augmentation')
62 | for scale in data_aug_scales:
63 | img_size = tuple([int(img.size[0] * scale), int(img.size[1] * scale)])
64 | img_sc = img.resize(img_size)
65 | label_sc = label.resize(img_size)
66 | self.images_train.append(np.array(img_sc, dtype=np.uint8))
67 | self.labels_train.append(np.array(label_sc, dtype=np.uint8))
68 | if data_aug_flip:
69 | img_sc_fl = img_sc.transpose(Image.FLIP_LEFT_RIGHT)
70 | label_sc_fl = label_sc.transpose(Image.FLIP_LEFT_RIGHT)
71 | self.images_train.append(np.array(img_sc_fl, dtype=np.uint8))
72 | self.labels_train.append(np.array(label_sc_fl, dtype=np.uint8))
73 | else:
74 | if idx == 0: sys.stdout.write('Loading the data')
75 | self.images_train.append(np.array(img, dtype=np.uint8))
76 | self.labels_train.append(np.array(label, dtype=np.uint8))
77 | if (idx + 1) % 50 == 0:
78 | sys.stdout.write('.')
79 | self.images_train_path.append(os.path.join(database_root, str(line.split()[0])))
80 | self.labels_train_path.append(os.path.join(database_root, str(line.split()[1])))
81 | sys.stdout.write('\n')
82 | self.images_train_path = np.array(self.images_train_path)
83 | self.labels_train_path = np.array(self.labels_train_path)
84 |
85 | # Load testing images (path) and labels
86 | self.images_test = []
87 | self.images_test_path = []
88 | for idx, line in enumerate(test_paths):
89 | if store_memory:
90 | self.images_test.append(np.array(Image.open(os.path.join(database_root, str(line.split()[0]))),
91 | dtype=np.uint8))
92 | if (idx + 1) % 1000 == 0:
93 | print('Loaded ' + str(idx) + ' test images')
94 | self.images_test_path.append(os.path.join(database_root, str(line.split()[0])))
95 | print('Done initializing Dataset')
96 |
97 | # Init parameters
98 | self.train_ptr = 0
99 | self.test_ptr = 0
100 | self.train_size = max(len(self.images_train_path), len(self.images_train))
101 | self.test_size = len(self.images_test_path)
102 | self.train_idx = np.arange(self.train_size)
103 | np.random.shuffle(self.train_idx)
104 | self.store_memory = store_memory
105 |
106 | def next_batch(self, batch_size, phase):
107 | """Get next batch of image (path) and labels
108 | Args:
109 | batch_size: Size of the batch
110 | phase: Possible options:'train' or 'test'
111 | Returns in training:
112 | images: List of images paths if store_memory=False, List of Numpy arrays of the images if store_memory=True
113 | labels: List of labels paths if store_memory=False, List of Numpy arrays of the labels if store_memory=True
114 | Returns in testing:
115 | images: None if store_memory=False, Numpy array of the image if store_memory=True
116 | path: List of image paths
117 | """
118 | if phase == 'train':
119 | if self.train_ptr + batch_size < self.train_size:
120 | idx = np.array(self.train_idx[self.train_ptr:self.train_ptr + batch_size])
121 | if self.store_memory:
122 | images = [self.images_train[l] for l in idx]
123 | labels = [self.labels_train[l] for l in idx]
124 | else:
125 | images = [self.images_train_path[l] for l in idx]
126 | labels = [self.labels_train_path[l] for l in idx]
127 | self.train_ptr += batch_size
128 | else:
129 | old_idx = np.array(self.train_idx[self.train_ptr:])
130 | np.random.shuffle(self.train_idx)
131 | new_ptr = (self.train_ptr + batch_size) % self.train_size
132 | idx = np.array(self.train_idx[:new_ptr])
133 | if self.store_memory:
134 | images_1 = [self.images_train[l] for l in old_idx]
135 | labels_1 = [self.labels_train[l] for l in old_idx]
136 | images_2 = [self.images_train[l] for l in idx]
137 | labels_2 = [self.labels_train[l] for l in idx]
138 | else:
139 | images_1 = [self.images_train_path[l] for l in old_idx]
140 | labels_1 = [self.labels_train_path[l] for l in old_idx]
141 | images_2 = [self.images_train_path[l] for l in idx]
142 | labels_2 = [self.labels_train_path[l] for l in idx]
143 | images = images_1 + images_2
144 | labels = labels_1 + labels_2
145 | self.train_ptr = new_ptr
146 | return images, labels
147 | elif phase == 'test':
148 | images = None
149 | if self.test_ptr + batch_size < self.test_size:
150 | if self.store_memory:
151 | images = self.images_test[self.test_ptr:self.test_ptr + batch_size]
152 | paths = self.images_test_path[self.test_ptr:self.test_ptr + batch_size]
153 | self.test_ptr += batch_size
154 | else:
155 | new_ptr = (self.test_ptr + batch_size) % self.test_size
156 | if self.store_memory:
157 | images = self.images_test[self.test_ptr:] + self.images_test[:new_ptr]
158 | paths = self.images_test_path[self.test_ptr:] + self.images_test_path[:new_ptr]
159 | self.test_ptr = new_ptr
160 | return images, paths
161 | else:
162 | return None, None
163 |
164 | def get_train_size(self):
165 | return self.train_size
166 |
167 | def get_test_size(self):
168 | return self.test_size
169 |
170 | def train_img_size(self):
171 | width, height = Image.open(self.images_train[self.train_ptr]).size
172 | return height, width
173 |
--------------------------------------------------------------------------------
/doc/ims/osvos.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scaelles/OSVOS-TensorFlow/6ef61d1f523296b95974a6dafac01e94bf2fde7d/doc/ims/osvos.png
--------------------------------------------------------------------------------
/models/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore everything in this directory
2 | *
3 | # Except this file
4 | !.gitignore
5 |
--------------------------------------------------------------------------------
/osvos.py:
--------------------------------------------------------------------------------
1 | from __future__ import print_function
2 | """
3 | Sergi Caelles (scaelles@vision.ee.ethz.ch)
4 |
5 | This file is part of the OSVOS paper presented in:
6 | Sergi Caelles, Kevis-Kokitsi Maninis, Jordi Pont-Tuset, Laura Leal-Taixe, Daniel Cremers, Luc Van Gool
7 | One-Shot Video Object Segmentation
8 | CVPR 2017
9 | Please consider citing the paper if you use this code.
10 | """
11 | import tensorflow as tf
12 | import numpy as np
13 | from tensorflow.contrib.layers.python.layers import utils
14 | import sys
15 | from datetime import datetime
16 | import os
17 | import scipy.misc
18 | from PIL import Image
19 | import six
20 |
21 | slim = tf.contrib.slim
22 |
23 |
24 | def osvos_arg_scope(weight_decay=0.0002):
25 | """Defines the OSVOS arg scope.
26 | Args:
27 | weight_decay: The l2 regularization coefficient.
28 | Returns:
29 | An arg_scope.
30 | """
31 | with slim.arg_scope([slim.conv2d, slim.convolution2d_transpose],
32 | activation_fn=tf.nn.relu,
33 | weights_initializer=tf.random_normal_initializer(stddev=0.001),
34 | weights_regularizer=slim.l2_regularizer(weight_decay),
35 | biases_initializer=tf.zeros_initializer(),
36 | biases_regularizer=None,
37 | padding='SAME') as arg_sc:
38 | return arg_sc
39 |
40 |
41 | def crop_features(feature, out_size):
42 | """Crop the center of a feature map
43 | Args:
44 | feature: Feature map to crop
45 | out_size: Size of the output feature map
46 | Returns:
47 | Tensor that performs the cropping
48 | """
49 | up_size = tf.shape(feature)
50 | ini_w = tf.div(tf.subtract(up_size[1], out_size[1]), 2)
51 | ini_h = tf.div(tf.subtract(up_size[2], out_size[2]), 2)
52 | slice_input = tf.slice(feature, (0, ini_w, ini_h, 0), (-1, out_size[1], out_size[2], -1))
53 | # slice_input = tf.slice(feature, (0, ini_w, ini_w, 0), (-1, out_size[1], out_size[2], -1)) # Caffe cropping way
54 | return tf.reshape(slice_input, [int(feature.get_shape()[0]), out_size[1], out_size[2], int(feature.get_shape()[3])])
55 |
56 |
57 | def osvos(inputs, scope='osvos'):
58 | """Defines the OSVOS network
59 | Args:
60 | inputs: Tensorflow placeholder that contains the input image
61 | scope: Scope name for the network
62 | Returns:
63 | net: Output Tensor of the network
64 | end_points: Dictionary with all Tensors of the network
65 | """
66 | im_size = tf.shape(inputs)
67 |
68 | with tf.variable_scope(scope, 'osvos', [inputs]) as sc:
69 | end_points_collection = sc.name + '_end_points'
70 | # Collect outputs of all intermediate layers.
71 | with slim.arg_scope([slim.conv2d, slim.max_pool2d],
72 | padding='SAME',
73 | outputs_collections=end_points_collection):
74 | net = slim.repeat(inputs, 2, slim.conv2d, 64, [3, 3], scope='conv1')
75 | net = slim.max_pool2d(net, [2, 2], scope='pool1')
76 | net_2 = slim.repeat(net, 2, slim.conv2d, 128, [3, 3], scope='conv2')
77 | net = slim.max_pool2d(net_2, [2, 2], scope='pool2')
78 | net_3 = slim.repeat(net, 3, slim.conv2d, 256, [3, 3], scope='conv3')
79 | net = slim.max_pool2d(net_3, [2, 2], scope='pool3')
80 | net_4 = slim.repeat(net, 3, slim.conv2d, 512, [3, 3], scope='conv4')
81 | net = slim.max_pool2d(net_4, [2, 2], scope='pool4')
82 | net_5 = slim.repeat(net, 3, slim.conv2d, 512, [3, 3], scope='conv5')
83 |
84 | # Get side outputs of the network
85 | with slim.arg_scope([slim.conv2d],
86 | activation_fn=None):
87 | side_2 = slim.conv2d(net_2, 16, [3, 3], scope='conv2_2_16')
88 | side_3 = slim.conv2d(net_3, 16, [3, 3], scope='conv3_3_16')
89 | side_4 = slim.conv2d(net_4, 16, [3, 3], scope='conv4_3_16')
90 | side_5 = slim.conv2d(net_5, 16, [3, 3], scope='conv5_3_16')
91 |
92 | # Supervise side outputs
93 | side_2_s = slim.conv2d(side_2, 1, [1, 1], scope='score-dsn_2')
94 | side_3_s = slim.conv2d(side_3, 1, [1, 1], scope='score-dsn_3')
95 | side_4_s = slim.conv2d(side_4, 1, [1, 1], scope='score-dsn_4')
96 | side_5_s = slim.conv2d(side_5, 1, [1, 1], scope='score-dsn_5')
97 | with slim.arg_scope([slim.convolution2d_transpose],
98 | activation_fn=None, biases_initializer=None, padding='VALID',
99 | outputs_collections=end_points_collection, trainable=False):
100 | # Side outputs
101 | side_2_s = slim.convolution2d_transpose(side_2_s, 1, 4, 2, scope='score-dsn_2-up')
102 | side_2_s = crop_features(side_2_s, im_size)
103 | utils.collect_named_outputs(end_points_collection, 'osvos/score-dsn_2-cr', side_2_s)
104 | side_3_s = slim.convolution2d_transpose(side_3_s, 1, 8, 4, scope='score-dsn_3-up')
105 | side_3_s = crop_features(side_3_s, im_size)
106 | utils.collect_named_outputs(end_points_collection, 'osvos/score-dsn_3-cr', side_3_s)
107 | side_4_s = slim.convolution2d_transpose(side_4_s, 1, 16, 8, scope='score-dsn_4-up')
108 | side_4_s = crop_features(side_4_s, im_size)
109 | utils.collect_named_outputs(end_points_collection, 'osvos/score-dsn_4-cr', side_4_s)
110 | side_5_s = slim.convolution2d_transpose(side_5_s, 1, 32, 16, scope='score-dsn_5-up')
111 | side_5_s = crop_features(side_5_s, im_size)
112 | utils.collect_named_outputs(end_points_collection, 'osvos/score-dsn_5-cr', side_5_s)
113 |
114 | # Main output
115 | side_2_f = slim.convolution2d_transpose(side_2, 16, 4, 2, scope='score-multi2-up')
116 | side_2_f = crop_features(side_2_f, im_size)
117 | utils.collect_named_outputs(end_points_collection, 'osvos/side-multi2-cr', side_2_f)
118 | side_3_f = slim.convolution2d_transpose(side_3, 16, 8, 4, scope='score-multi3-up')
119 | side_3_f = crop_features(side_3_f, im_size)
120 | utils.collect_named_outputs(end_points_collection, 'osvos/side-multi3-cr', side_3_f)
121 | side_4_f = slim.convolution2d_transpose(side_4, 16, 16, 8, scope='score-multi4-up')
122 | side_4_f = crop_features(side_4_f, im_size)
123 | utils.collect_named_outputs(end_points_collection, 'osvos/side-multi4-cr', side_4_f)
124 | side_5_f = slim.convolution2d_transpose(side_5, 16, 32, 16, scope='score-multi5-up')
125 | side_5_f = crop_features(side_5_f, im_size)
126 | utils.collect_named_outputs(end_points_collection, 'osvos/side-multi5-cr', side_5_f)
127 | concat_side = tf.concat([side_2_f, side_3_f, side_4_f, side_5_f], axis=3)
128 |
129 | net = slim.conv2d(concat_side, 1, [1, 1], scope='upscore-fuse')
130 |
131 | end_points = slim.utils.convert_collection_to_dict(end_points_collection)
132 | return net, end_points
133 |
134 |
135 | def upsample_filt(size):
136 | factor = (size + 1) // 2
137 | if size % 2 == 1:
138 | center = factor - 1
139 | else:
140 | center = factor - 0.5
141 | og = np.ogrid[:size, :size]
142 | return (1 - abs(og[0] - center) / factor) * \
143 | (1 - abs(og[1] - center) / factor)
144 |
145 |
146 | # Set deconvolutional layers to compute bilinear interpolation
147 | def interp_surgery(variables):
148 | interp_tensors = []
149 | for v in variables:
150 | if '-up' in v.name:
151 | h, w, k, m = v.get_shape()
152 | tmp = np.zeros((m, k, h, w))
153 | if m != k:
154 | raise ValueError('input + output channels need to be the same')
155 | if h != w:
156 | raise ValueError('filters need to be square')
157 | up_filter = upsample_filt(int(h))
158 | tmp[range(m), range(k), :, :] = up_filter
159 | interp_tensors.append(tf.assign(v, tmp.transpose((2, 3, 1, 0)), validate_shape=True, use_locking=True))
160 | return interp_tensors
161 |
162 |
163 | # TO DO: Move preprocessing into Tensorflow
164 | def preprocess_img(image):
165 | """Preprocess the image to adapt it to network requirements
166 | Args:
167 | Image we want to input the network (W,H,3) numpy array
168 | Returns:
169 | Image ready to input the network (1,W,H,3)
170 | """
171 | if type(image) is not np.ndarray:
172 | image = np.array(Image.open(image), dtype=np.uint8)
173 | in_ = image[:, :, ::-1]
174 | in_ = np.subtract(in_, np.array((104.00699, 116.66877, 122.67892), dtype=np.float32))
175 | # in_ = tf.subtract(tf.cast(in_, tf.float32), np.array((104.00699, 116.66877, 122.67892), dtype=np.float32))
176 | in_ = np.expand_dims(in_, axis=0)
177 | # in_ = tf.expand_dims(in_, 0)
178 | return in_
179 |
180 |
181 | # TO DO: Move preprocessing into Tensorflow
182 | def preprocess_labels(label):
183 | """Preprocess the labels to adapt them to the loss computation requirements
184 | Args:
185 | Label corresponding to the input image (W,H) numpy array
186 | Returns:
187 | Label ready to compute the loss (1,W,H,1)
188 | """
189 | if type(label) is not np.ndarray:
190 | label = np.array(Image.open(label).split()[0], dtype=np.uint8)
191 | max_mask = np.max(label) * 0.5
192 | label = np.greater(label, max_mask)
193 | label = np.expand_dims(np.expand_dims(label, axis=0), axis=3)
194 | # label = tf.cast(np.array(label), tf.float32)
195 | # max_mask = tf.multiply(tf.reduce_max(label), 0.5)
196 | # label = tf.cast(tf.greater(label, max_mask), tf.float32)
197 | # label = tf.expand_dims(tf.expand_dims(label, 0), 3)
198 | return label
199 |
200 |
201 | def load_vgg_imagenet(ckpt_path):
202 | """Initialize the network parameters from the VGG-16 pre-trained model provided by TF-SLIM
203 | Args:
204 | Path to the checkpoint
205 | Returns:
206 | Function that takes a session and initializes the network
207 | """
208 | reader = tf.train.NewCheckpointReader(ckpt_path)
209 | var_to_shape_map = reader.get_variable_to_shape_map()
210 | vars_corresp = dict()
211 | for v in var_to_shape_map:
212 | if "conv" in v:
213 | vars_corresp[v] = slim.get_model_variables(v.replace("vgg_16", "osvos"))[0]
214 | init_fn = slim.assign_from_checkpoint_fn(
215 | ckpt_path,
216 | vars_corresp)
217 | return init_fn
218 |
219 |
220 | def class_balanced_cross_entropy_loss(output, label):
221 | """Define the class balanced cross entropy loss to train the network
222 | Args:
223 | output: Output of the network
224 | label: Ground truth label
225 | Returns:
226 | Tensor that evaluates the loss
227 | """
228 |
229 | labels = tf.cast(tf.greater(label, 0.5), tf.float32)
230 |
231 | num_labels_pos = tf.reduce_sum(labels)
232 | num_labels_neg = tf.reduce_sum(1.0 - labels)
233 | num_total = num_labels_pos + num_labels_neg
234 |
235 | output_gt_zero = tf.cast(tf.greater_equal(output, 0), tf.float32)
236 | loss_val = tf.multiply(output, (labels - output_gt_zero)) - tf.log(
237 | 1 + tf.exp(output - 2 * tf.multiply(output, output_gt_zero)))
238 |
239 | loss_pos = tf.reduce_sum(-tf.multiply(labels, loss_val))
240 | loss_neg = tf.reduce_sum(-tf.multiply(1.0 - labels, loss_val))
241 |
242 | final_loss = num_labels_neg / num_total * loss_pos + num_labels_pos / num_total * loss_neg
243 |
244 | return final_loss
245 |
246 |
247 | def class_balanced_cross_entropy_loss_theoretical(output, label):
248 | """Theoretical version of the class balanced cross entropy loss to train the network (Produces unstable results)
249 | Args:
250 | output: Output of the network
251 | label: Ground truth label
252 | Returns:
253 | Tensor that evaluates the loss
254 | """
255 | output = tf.nn.sigmoid(output)
256 |
257 | labels_pos = tf.cast(tf.greater(label, 0), tf.float32)
258 | labels_neg = tf.cast(tf.less(label, 1), tf.float32)
259 |
260 | num_labels_pos = tf.reduce_sum(labels_pos)
261 | num_labels_neg = tf.reduce_sum(labels_neg)
262 | num_total = num_labels_pos + num_labels_neg
263 |
264 | loss_pos = tf.reduce_sum(tf.multiply(labels_pos, tf.log(output + 0.00001)))
265 | loss_neg = tf.reduce_sum(tf.multiply(labels_neg, tf.log(1 - output + 0.00001)))
266 |
267 | final_loss = -num_labels_neg / num_total * loss_pos - num_labels_pos / num_total * loss_neg
268 |
269 | return final_loss
270 |
271 |
272 | def load_caffe_weights(weights_path):
273 | """Initialize the network parameters from a .npy caffe weights file
274 | Args:
275 | Path to the .npy file containing the value of the network parameters
276 | Returns:
277 | Function that takes a session and initializes the network
278 | """
279 | osvos_weights = np.load(weights_path).item()
280 | vars_corresp = dict()
281 | vars_corresp['osvos/conv1/conv1_1/weights'] = osvos_weights['conv1_1_w']
282 | vars_corresp['osvos/conv1/conv1_1/biases'] = osvos_weights['conv1_1_b']
283 | vars_corresp['osvos/conv1/conv1_2/weights'] = osvos_weights['conv1_2_w']
284 | vars_corresp['osvos/conv1/conv1_2/biases'] = osvos_weights['conv1_2_b']
285 |
286 | vars_corresp['osvos/conv2/conv2_1/weights'] = osvos_weights['conv2_1_w']
287 | vars_corresp['osvos/conv2/conv2_1/biases'] = osvos_weights['conv2_1_b']
288 | vars_corresp['osvos/conv2/conv2_2/weights'] = osvos_weights['conv2_2_w']
289 | vars_corresp['osvos/conv2/conv2_2/biases'] = osvos_weights['conv2_2_b']
290 |
291 | vars_corresp['osvos/conv3/conv3_1/weights'] = osvos_weights['conv3_1_w']
292 | vars_corresp['osvos/conv3/conv3_1/biases'] = osvos_weights['conv3_1_b']
293 | vars_corresp['osvos/conv3/conv3_2/weights'] = osvos_weights['conv3_2_w']
294 | vars_corresp['osvos/conv3/conv3_2/biases'] = osvos_weights['conv3_2_b']
295 | vars_corresp['osvos/conv3/conv3_3/weights'] = osvos_weights['conv3_3_w']
296 | vars_corresp['osvos/conv3/conv3_3/biases'] = osvos_weights['conv3_3_b']
297 |
298 | vars_corresp['osvos/conv4/conv4_1/weights'] = osvos_weights['conv4_1_w']
299 | vars_corresp['osvos/conv4/conv4_1/biases'] = osvos_weights['conv4_1_b']
300 | vars_corresp['osvos/conv4/conv4_2/weights'] = osvos_weights['conv4_2_w']
301 | vars_corresp['osvos/conv4/conv4_2/biases'] = osvos_weights['conv4_2_b']
302 | vars_corresp['osvos/conv4/conv4_3/weights'] = osvos_weights['conv4_3_w']
303 | vars_corresp['osvos/conv4/conv4_3/biases'] = osvos_weights['conv4_3_b']
304 |
305 | vars_corresp['osvos/conv5/conv5_1/weights'] = osvos_weights['conv5_1_w']
306 | vars_corresp['osvos/conv5/conv5_1/biases'] = osvos_weights['conv5_1_b']
307 | vars_corresp['osvos/conv5/conv5_2/weights'] = osvos_weights['conv5_2_w']
308 | vars_corresp['osvos/conv5/conv5_2/biases'] = osvos_weights['conv5_2_b']
309 | vars_corresp['osvos/conv5/conv5_3/weights'] = osvos_weights['conv5_3_w']
310 | vars_corresp['osvos/conv5/conv5_3/biases'] = osvos_weights['conv5_3_b']
311 |
312 | vars_corresp['osvos/conv2_2_16/weights'] = osvos_weights['conv2_2_16_w']
313 | vars_corresp['osvos/conv2_2_16/biases'] = osvos_weights['conv2_2_16_b']
314 | vars_corresp['osvos/conv3_3_16/weights'] = osvos_weights['conv3_3_16_w']
315 | vars_corresp['osvos/conv3_3_16/biases'] = osvos_weights['conv3_3_16_b']
316 | vars_corresp['osvos/conv4_3_16/weights'] = osvos_weights['conv4_3_16_w']
317 | vars_corresp['osvos/conv4_3_16/biases'] = osvos_weights['conv4_3_16_b']
318 | vars_corresp['osvos/conv5_3_16/weights'] = osvos_weights['conv5_3_16_w']
319 | vars_corresp['osvos/conv5_3_16/biases'] = osvos_weights['conv5_3_16_b']
320 |
321 | vars_corresp['osvos/score-dsn_2/weights'] = osvos_weights['score-dsn_2_w']
322 | vars_corresp['osvos/score-dsn_2/biases'] = osvos_weights['score-dsn_2_b']
323 | vars_corresp['osvos/score-dsn_3/weights'] = osvos_weights['score-dsn_3_w']
324 | vars_corresp['osvos/score-dsn_3/biases'] = osvos_weights['score-dsn_3_b']
325 | vars_corresp['osvos/score-dsn_4/weights'] = osvos_weights['score-dsn_4_w']
326 | vars_corresp['osvos/score-dsn_4/biases'] = osvos_weights['score-dsn_4_b']
327 | vars_corresp['osvos/score-dsn_5/weights'] = osvos_weights['score-dsn_5_w']
328 | vars_corresp['osvos/score-dsn_5/biases'] = osvos_weights['score-dsn_5_b']
329 |
330 | vars_corresp['osvos/upscore-fuse/weights'] = osvos_weights['new-score-weighting_w']
331 | vars_corresp['osvos/upscore-fuse/biases'] = osvos_weights['new-score-weighting_b']
332 | return slim.assign_from_values_fn(vars_corresp)
333 |
334 |
335 | def parameter_lr():
336 | """Specify the relative learning rate for every parameter. The final learning rate
337 | in every parameter will be the one defined here multiplied by the global one
338 | Args:
339 | Returns:
340 | Dictionary with the relative learning rate for every parameter
341 | """
342 |
343 | vars_corresp = dict()
344 | vars_corresp['osvos/conv1/conv1_1/weights'] = 1
345 | vars_corresp['osvos/conv1/conv1_1/biases'] = 2
346 | vars_corresp['osvos/conv1/conv1_2/weights'] = 1
347 | vars_corresp['osvos/conv1/conv1_2/biases'] = 2
348 |
349 | vars_corresp['osvos/conv2/conv2_1/weights'] = 1
350 | vars_corresp['osvos/conv2/conv2_1/biases'] = 2
351 | vars_corresp['osvos/conv2/conv2_2/weights'] = 1
352 | vars_corresp['osvos/conv2/conv2_2/biases'] = 2
353 |
354 | vars_corresp['osvos/conv3/conv3_1/weights'] = 1
355 | vars_corresp['osvos/conv3/conv3_1/biases'] = 2
356 | vars_corresp['osvos/conv3/conv3_2/weights'] = 1
357 | vars_corresp['osvos/conv3/conv3_2/biases'] = 2
358 | vars_corresp['osvos/conv3/conv3_3/weights'] = 1
359 | vars_corresp['osvos/conv3/conv3_3/biases'] = 2
360 |
361 | vars_corresp['osvos/conv4/conv4_1/weights'] = 1
362 | vars_corresp['osvos/conv4/conv4_1/biases'] = 2
363 | vars_corresp['osvos/conv4/conv4_2/weights'] = 1
364 | vars_corresp['osvos/conv4/conv4_2/biases'] = 2
365 | vars_corresp['osvos/conv4/conv4_3/weights'] = 1
366 | vars_corresp['osvos/conv4/conv4_3/biases'] = 2
367 |
368 | vars_corresp['osvos/conv5/conv5_1/weights'] = 1
369 | vars_corresp['osvos/conv5/conv5_1/biases'] = 2
370 | vars_corresp['osvos/conv5/conv5_2/weights'] = 1
371 | vars_corresp['osvos/conv5/conv5_2/biases'] = 2
372 | vars_corresp['osvos/conv5/conv5_3/weights'] = 1
373 | vars_corresp['osvos/conv5/conv5_3/biases'] = 2
374 |
375 | vars_corresp['osvos/conv2_2_16/weights'] = 1
376 | vars_corresp['osvos/conv2_2_16/biases'] = 2
377 | vars_corresp['osvos/conv3_3_16/weights'] = 1
378 | vars_corresp['osvos/conv3_3_16/biases'] = 2
379 | vars_corresp['osvos/conv4_3_16/weights'] = 1
380 | vars_corresp['osvos/conv4_3_16/biases'] = 2
381 | vars_corresp['osvos/conv5_3_16/weights'] = 1
382 | vars_corresp['osvos/conv5_3_16/biases'] = 2
383 |
384 | vars_corresp['osvos/score-dsn_2/weights'] = 0.1
385 | vars_corresp['osvos/score-dsn_2/biases'] = 0.2
386 | vars_corresp['osvos/score-dsn_3/weights'] = 0.1
387 | vars_corresp['osvos/score-dsn_3/biases'] = 0.2
388 | vars_corresp['osvos/score-dsn_4/weights'] = 0.1
389 | vars_corresp['osvos/score-dsn_4/biases'] = 0.2
390 | vars_corresp['osvos/score-dsn_5/weights'] = 0.1
391 | vars_corresp['osvos/score-dsn_5/biases'] = 0.2
392 |
393 | vars_corresp['osvos/upscore-fuse/weights'] = 0.01
394 | vars_corresp['osvos/upscore-fuse/biases'] = 0.02
395 | return vars_corresp
396 |
397 |
398 | def _train(dataset, initial_ckpt, supervison, learning_rate, logs_path, max_training_iters, save_step, display_step,
399 | global_step, iter_mean_grad=1, batch_size=1, momentum=0.9, resume_training=False, config=None, finetune=1,
400 | test_image_path=None, ckpt_name="osvos"):
401 | """Train OSVOS
402 | Args:
403 | dataset: Reference to a Dataset object instance
404 | initial_ckpt: Path to the checkpoint to initialize the network (May be parent network or pre-trained Imagenet)
405 | supervison: Level of the side outputs supervision: 1-Strong 2-Weak 3-No supervision
406 | learning_rate: Value for the learning rate. It can be a number or an instance to a learning rate object.
407 | logs_path: Path to store the checkpoints
408 | max_training_iters: Number of training iterations
409 | save_step: A checkpoint will be created every save_steps
410 | display_step: Information of the training will be displayed every display_steps
411 | global_step: Reference to a Variable that keeps track of the training steps
412 | iter_mean_grad: Number of gradient computations that are average before updating the weights
413 | batch_size: Size of the training batch
414 | momentum: Value of the momentum parameter for the Momentum optimizer
415 | resume_training: Boolean to try to restore from a previous checkpoint (True) or not (False)
416 | config: Reference to a Configuration object used in the creation of a Session
417 | finetune: Use to select the type of training, 0 for the parent network and 1 for finetunning
418 | test_image_path: If image path provided, every save_step the result of the network with this image is stored
419 | Returns:
420 | """
421 | model_name = os.path.join(logs_path, ckpt_name+".ckpt")
422 | if config is None:
423 | config = tf.ConfigProto()
424 | config.gpu_options.allow_growth = True
425 | # config.log_device_placement = True
426 | config.allow_soft_placement = True
427 |
428 | tf.logging.set_verbosity(tf.logging.INFO)
429 |
430 | # Prepare the input data
431 | input_image = tf.placeholder(tf.float32, [batch_size, None, None, 3])
432 | input_label = tf.placeholder(tf.float32, [batch_size, None, None, 1])
433 |
434 | # Create the network
435 | with slim.arg_scope(osvos_arg_scope()):
436 | net, end_points = osvos(input_image)
437 |
438 | # Initialize weights from pre-trained model
439 | if finetune == 0:
440 | init_weights = load_vgg_imagenet(initial_ckpt)
441 |
442 | # Define loss
443 | with tf.name_scope('losses'):
444 | if supervison == 1 or supervison == 2:
445 | dsn_2_loss = class_balanced_cross_entropy_loss(end_points['osvos/score-dsn_2-cr'], input_label)
446 | tf.summary.scalar('dsn_2_loss', dsn_2_loss)
447 | dsn_3_loss = class_balanced_cross_entropy_loss(end_points['osvos/score-dsn_3-cr'], input_label)
448 | tf.summary.scalar('dsn_3_loss', dsn_3_loss)
449 | dsn_4_loss = class_balanced_cross_entropy_loss(end_points['osvos/score-dsn_4-cr'], input_label)
450 | tf.summary.scalar('dsn_4_loss', dsn_4_loss)
451 | dsn_5_loss = class_balanced_cross_entropy_loss(end_points['osvos/score-dsn_5-cr'], input_label)
452 | tf.summary.scalar('dsn_5_loss', dsn_5_loss)
453 |
454 | main_loss = class_balanced_cross_entropy_loss(net, input_label)
455 | tf.summary.scalar('main_loss', main_loss)
456 |
457 | if supervison == 1:
458 | output_loss = dsn_2_loss + dsn_3_loss + dsn_4_loss + dsn_5_loss + main_loss
459 | elif supervison == 2:
460 | output_loss = 0.5 * dsn_2_loss + 0.5 * dsn_3_loss + 0.5 * dsn_4_loss + 0.5 * dsn_5_loss + main_loss
461 | elif supervison == 3:
462 | output_loss = main_loss
463 | else:
464 | sys.exit('Incorrect supervision id, select 1 for supervision of the side outputs, 2 for weak supervision '
465 | 'of the side outputs and 3 for no supervision of the side outputs')
466 | total_loss = output_loss + tf.add_n(tf.losses.get_regularization_losses())
467 | tf.summary.scalar('total_loss', total_loss)
468 |
469 | # Define optimization method
470 | with tf.name_scope('optimization'):
471 | tf.summary.scalar('learning_rate', learning_rate)
472 | optimizer = tf.train.MomentumOptimizer(learning_rate, momentum)
473 | grads_and_vars = optimizer.compute_gradients(total_loss)
474 | with tf.name_scope('grad_accumulator'):
475 | grad_accumulator = {}
476 | for ind in range(0, len(grads_and_vars)):
477 | if grads_and_vars[ind][0] is not None:
478 | grad_accumulator[ind] = tf.ConditionalAccumulator(grads_and_vars[ind][0].dtype)
479 | with tf.name_scope('apply_gradient'):
480 | layer_lr = parameter_lr()
481 | grad_accumulator_ops = []
482 | for var_ind, grad_acc in six.iteritems(grad_accumulator):
483 | var_name = str(grads_and_vars[var_ind][1].name).split(':')[0]
484 | var_grad = grads_and_vars[var_ind][0]
485 | grad_accumulator_ops.append(grad_acc.apply_grad(var_grad * layer_lr[var_name],
486 | local_step=global_step))
487 | with tf.name_scope('take_gradients'):
488 | mean_grads_and_vars = []
489 | for var_ind, grad_acc in six.iteritems(grad_accumulator):
490 | mean_grads_and_vars.append(
491 | (grad_acc.take_grad(iter_mean_grad), grads_and_vars[var_ind][1]))
492 | apply_gradient_op = optimizer.apply_gradients(mean_grads_and_vars, global_step=global_step)
493 | # Log training info
494 | merged_summary_op = tf.summary.merge_all()
495 |
496 | # Log evolution of test image
497 | if test_image_path is not None:
498 | probabilities = tf.nn.sigmoid(net)
499 | img_summary = tf.summary.image("Output probabilities", probabilities, max_outputs=1)
500 | # Initialize variables
501 | init = tf.global_variables_initializer()
502 |
503 | # Create objects to record timing and memory of the graph execution
504 | # run_options = tf.RunOptions(trace_level=tf.RunOptions.FULL_TRACE) # Option in the session options=run_options
505 | # run_metadata = tf.RunMetadata() # Option in the session run_metadata=run_metadata
506 | # summary_writer.add_run_metadata(run_metadata, 'step%d' % i)
507 | with tf.Session(config=config) as sess:
508 | print('Init variable')
509 | sess.run(init)
510 |
511 | # op to write logs to Tensorboard
512 | summary_writer = tf.summary.FileWriter(logs_path, graph=tf.get_default_graph())
513 |
514 | # Create saver to manage checkpoints
515 | saver = tf.train.Saver(max_to_keep=None)
516 |
517 | last_ckpt_path = tf.train.latest_checkpoint(logs_path)
518 | if last_ckpt_path is not None and resume_training:
519 | # Load last checkpoint
520 | print('Initializing from previous checkpoint...')
521 | saver.restore(sess, last_ckpt_path)
522 | step = global_step.eval() + 1
523 | else:
524 | # Load pre-trained model
525 | if finetune == 0:
526 | print('Initializing from pre-trained imagenet model...')
527 | init_weights(sess)
528 | else:
529 | print('Initializing from specified pre-trained model...')
530 | # init_weights(sess)
531 | var_list = []
532 | for var in tf.global_variables():
533 | var_type = var.name.split('/')[-1]
534 | if 'weights' in var_type or 'bias' in var_type:
535 | var_list.append(var)
536 | saver_res = tf.train.Saver(var_list=var_list)
537 | saver_res.restore(sess, initial_ckpt)
538 | step = 1
539 | sess.run(interp_surgery(tf.global_variables()))
540 | print('Weights initialized')
541 |
542 | print('Start training')
543 | while step < max_training_iters + 1:
544 | # Average the gradient
545 | for _ in range(0, iter_mean_grad):
546 | batch_image, batch_label = dataset.next_batch(batch_size, 'train')
547 | image = preprocess_img(batch_image[0])
548 | label = preprocess_labels(batch_label[0])
549 | run_res = sess.run([total_loss, merged_summary_op] + grad_accumulator_ops,
550 | feed_dict={input_image: image, input_label: label})
551 | batch_loss = run_res[0]
552 | summary = run_res[1]
553 |
554 | # Apply the gradients
555 | sess.run(apply_gradient_op) # Momentum updates here its statistics
556 |
557 | # Save summary reports
558 | summary_writer.add_summary(summary, step)
559 |
560 | # Display training status
561 | if step % display_step == 0:
562 | print("{} Iter {}: Training Loss = {:.4f}".format(datetime.now(), step, batch_loss), file=sys.stderr)
563 |
564 | # Save a checkpoint
565 | if step % save_step == 0:
566 | if test_image_path is not None:
567 | curr_output = sess.run(img_summary, feed_dict={input_image: preprocess_img(test_image_path)})
568 | summary_writer.add_summary(curr_output, step)
569 | save_path = saver.save(sess, model_name, global_step=global_step)
570 | print("Model saved in file: %s" % save_path)
571 |
572 | step += 1
573 |
574 | if (step - 1) % save_step != 0:
575 | save_path = saver.save(sess, model_name, global_step=global_step)
576 | print("Model saved in file: %s" % save_path)
577 |
578 | print('Finished training.')
579 |
580 |
581 | def train_parent(dataset, initial_ckpt, supervison, learning_rate, logs_path, max_training_iters, save_step,
582 | display_step, global_step, iter_mean_grad=1, batch_size=1, momentum=0.9, resume_training=False,
583 | config=None, test_image_path=None, ckpt_name="osvos"):
584 | """Train OSVOS parent network
585 | Args:
586 | See _train()
587 | Returns:
588 | """
589 | finetune = 0
590 | _train(dataset, initial_ckpt, supervison, learning_rate, logs_path, max_training_iters, save_step, display_step,
591 | global_step, iter_mean_grad, batch_size, momentum, resume_training, config, finetune, test_image_path,
592 | ckpt_name)
593 |
594 |
595 | def train_finetune(dataset, initial_ckpt, supervison, learning_rate, logs_path, max_training_iters, save_step,
596 | display_step, global_step, iter_mean_grad=1, batch_size=1, momentum=0.9, resume_training=False,
597 | config=None, test_image_path=None, ckpt_name="osvos"):
598 | """Finetune OSVOS
599 | Args:
600 | See _train()
601 | Returns:
602 | """
603 | finetune = 1
604 | _train(dataset, initial_ckpt, supervison, learning_rate, logs_path, max_training_iters, save_step, display_step,
605 | global_step, iter_mean_grad, batch_size, momentum, resume_training, config, finetune, test_image_path,
606 | ckpt_name)
607 |
608 |
609 | def test(dataset, checkpoint_file, result_path, config=None):
610 | """Test one sequence
611 | Args:
612 | dataset: Reference to a Dataset object instance
613 | checkpoint_path: Path of the checkpoint to use for the evaluation
614 | result_path: Path to save the output images
615 | config: Reference to a Configuration object used in the creation of a Session
616 | Returns:
617 | """
618 | if config is None:
619 | config = tf.ConfigProto()
620 | config.gpu_options.allow_growth = True
621 | # config.log_device_placement = True
622 | config.allow_soft_placement = True
623 | tf.logging.set_verbosity(tf.logging.INFO)
624 |
625 | # Input data
626 | batch_size = 1
627 | input_image = tf.placeholder(tf.float32, [batch_size, None, None, 3])
628 |
629 | # Create the cnn
630 | with slim.arg_scope(osvos_arg_scope()):
631 | net, end_points = osvos(input_image)
632 | probabilities = tf.nn.sigmoid(net)
633 | global_step = tf.Variable(0, name='global_step', trainable=False)
634 |
635 | # Create a saver to load the network
636 | saver = tf.train.Saver([v for v in tf.global_variables() if '-up' not in v.name and '-cr' not in v.name])
637 |
638 | with tf.Session(config=config) as sess:
639 | sess.run(tf.global_variables_initializer())
640 | sess.run(interp_surgery(tf.global_variables()))
641 | saver.restore(sess, checkpoint_file)
642 | if not os.path.exists(result_path):
643 | os.makedirs(result_path)
644 | for frame in range(0, dataset.get_test_size()):
645 | img, curr_img = dataset.next_batch(batch_size, 'test')
646 | curr_frame_orig_name = os.path.split(curr_img[0])[1]
647 | curr_frame = os.path.splitext(curr_frame_orig_name)[0] + '.png'
648 | image = preprocess_img(img[0])
649 | res = sess.run(probabilities, feed_dict={input_image: image})
650 | res_np = res.astype(np.float32)[0, :, :, 0] > 162.0/255.0
651 | scipy.misc.imsave(os.path.join(result_path, curr_frame), res_np.astype(np.float32))
652 | print('Saving ' + os.path.join(result_path, curr_frame))
653 |
654 |
655 |
656 |
--------------------------------------------------------------------------------
/osvos_demo.py:
--------------------------------------------------------------------------------
1 | from __future__ import print_function
2 | """
3 | Sergi Caelles (scaelles@vision.ee.ethz.ch)
4 |
5 | This file is part of the OSVOS paper presented in:
6 | Sergi Caelles, Kevis-Kokitsi Maninis, Jordi Pont-Tuset, Laura Leal-Taixe, Daniel Cremers, Luc Van Gool
7 | One-Shot Video Object Segmentation
8 | CVPR 2017
9 | Please consider citing the paper if you use this code.
10 | """
11 | import os
12 | import sys
13 | from PIL import Image
14 | import numpy as np
15 | import tensorflow as tf
16 | slim = tf.contrib.slim
17 | import matplotlib.pyplot as plt
18 | # Import OSVOS files
19 | root_folder = os.path.dirname(os.path.realpath(__file__))
20 | sys.path.append(os.path.abspath(root_folder))
21 | import osvos
22 | from dataset import Dataset
23 | os.chdir(root_folder)
24 |
25 | # User defined parameters
26 | seq_name = "car-shadow"
27 | gpu_id = 0
28 | train_model = True
29 | result_path = os.path.join('DAVIS', 'Results', 'Segmentations', '480p', 'OSVOS', seq_name)
30 |
31 | # Train parameters
32 | parent_path = os.path.join('models', 'OSVOS_parent', 'OSVOS_parent.ckpt-50000')
33 | logs_path = os.path.join('models', seq_name)
34 | max_training_iters = 500
35 |
36 | # Define Dataset
37 | test_frames = sorted(os.listdir(os.path.join('DAVIS', 'JPEGImages', '480p', seq_name)))
38 | test_imgs = [os.path.join('DAVIS', 'JPEGImages', '480p', seq_name, frame) for frame in test_frames]
39 | if train_model:
40 | train_imgs = [os.path.join('DAVIS', 'JPEGImages', '480p', seq_name, '00000.jpg')+' '+
41 | os.path.join('DAVIS', 'Annotations', '480p', seq_name, '00000.png')]
42 | dataset = Dataset(train_imgs, test_imgs, './', data_aug=True)
43 | else:
44 | dataset = Dataset(None, test_imgs, './')
45 |
46 | # Train the network
47 | if train_model:
48 | # More training parameters
49 | learning_rate = 1e-8
50 | save_step = max_training_iters
51 | side_supervision = 3
52 | display_step = 10
53 | with tf.Graph().as_default():
54 | with tf.device('/gpu:' + str(gpu_id)):
55 | global_step = tf.Variable(0, name='global_step', trainable=False)
56 | osvos.train_finetune(dataset, parent_path, side_supervision, learning_rate, logs_path, max_training_iters,
57 | save_step, display_step, global_step, iter_mean_grad=1, ckpt_name=seq_name)
58 |
59 | # Test the network
60 | with tf.Graph().as_default():
61 | with tf.device('/gpu:' + str(gpu_id)):
62 | checkpoint_path = os.path.join('models', seq_name, seq_name+'.ckpt-'+str(max_training_iters))
63 | osvos.test(dataset, checkpoint_path, result_path)
64 |
65 | # Show results
66 | overlay_color = [255, 0, 0]
67 | transparency = 0.6
68 | plt.ion()
69 | for img_p in test_frames:
70 | frame_num = img_p.split('.')[0]
71 | img = np.array(Image.open(os.path.join('DAVIS', 'JPEGImages', '480p', seq_name, img_p)))
72 | mask = np.array(Image.open(os.path.join(result_path, frame_num+'.png')))
73 | mask = mask//np.max(mask)
74 | im_over = np.ndarray(img.shape)
75 | im_over[:, :, 0] = (1 - mask) * img[:, :, 0] + mask * (overlay_color[0]*transparency + (1-transparency)*img[:, :, 0])
76 | im_over[:, :, 1] = (1 - mask) * img[:, :, 1] + mask * (overlay_color[1]*transparency + (1-transparency)*img[:, :, 1])
77 | im_over[:, :, 2] = (1 - mask) * img[:, :, 2] + mask * (overlay_color[2]*transparency + (1-transparency)*img[:, :, 2])
78 | plt.imshow(im_over.astype(np.uint8))
79 | plt.axis('off')
80 | plt.show()
81 | plt.pause(0.01)
82 | plt.clf()
83 |
--------------------------------------------------------------------------------
/osvos_parent_demo.py:
--------------------------------------------------------------------------------
1 | """
2 | Sergi Caelles (scaelles@vision.ee.ethz.ch)
3 |
4 | This file is part of the OSVOS paper presented in:
5 | Sergi Caelles, Kevis-Kokitsi Maninis, Jordi Pont-Tuset, Laura Leal-Taixe, Daniel Cremers, Luc Van Gool
6 | One-Shot Video Object Segmentation
7 | CVPR 2017
8 | Please consider citing the paper if you use this code.
9 | """
10 | import os
11 | import sys
12 | import tensorflow as tf
13 | slim = tf.contrib.slim
14 | # Import OSVOS files
15 | root_folder = os.path.dirname(os.path.realpath(__file__))
16 | sys.path.append(os.path.abspath(root_folder))
17 | import osvos
18 | from dataset import Dataset
19 |
20 | # User defined parameters
21 | gpu_id = 0
22 |
23 | # Training parameters
24 | imagenet_ckpt = 'models/vgg_16.ckpt'
25 | logs_path = os.path.join(root_folder, 'models', 'OSVOS_parent')
26 | store_memory = True
27 | data_aug = True
28 | iter_mean_grad = 10
29 | max_training_iters_1 = 15000
30 | max_training_iters_2 = 30000
31 | max_training_iters_3 = 50000
32 | save_step = 5000
33 | test_image = None
34 | display_step = 100
35 | ini_learning_rate = 1e-8
36 | boundaries = [10000, 15000, 25000, 30000, 40000]
37 | values = [ini_learning_rate, ini_learning_rate * 0.1, ini_learning_rate, ini_learning_rate * 0.1, ini_learning_rate,
38 | ini_learning_rate * 0.1]
39 |
40 | # Define Dataset
41 | train_file = 'train_parent.txt'
42 | dataset = Dataset(train_file, None, './DAVIS', store_memory=store_memory, data_aug=data_aug)
43 |
44 | # Train the network
45 | with tf.Graph().as_default():
46 | with tf.device('/gpu:' + str(gpu_id)):
47 | global_step = tf.Variable(0, name='global_step', trainable=False)
48 | learning_rate = tf.train.piecewise_constant(global_step, boundaries, values)
49 | osvos.train_parent(dataset, imagenet_ckpt, 1, learning_rate, logs_path, max_training_iters_1, save_step,
50 | display_step, global_step, iter_mean_grad=iter_mean_grad, test_image_path=test_image,
51 | ckpt_name='OSVOS_parent')
52 |
53 | with tf.Graph().as_default():
54 | with tf.device('/gpu:' + str(gpu_id)):
55 | global_step = tf.Variable(max_training_iters_1, name='global_step', trainable=False)
56 | learning_rate = tf.train.piecewise_constant(global_step, boundaries, values)
57 | osvos.train_parent(dataset, imagenet_ckpt, 2, learning_rate, logs_path, max_training_iters_2, save_step,
58 | display_step, global_step, iter_mean_grad=iter_mean_grad, resume_training=True,
59 | test_image_path=test_image, ckpt_name='OSVOS_parent')
60 |
61 | with tf.Graph().as_default():
62 | with tf.device('/gpu:' + str(gpu_id)):
63 | global_step = tf.Variable(max_training_iters_2, name='global_step', trainable=False)
64 | learning_rate = tf.train.piecewise_constant(global_step, boundaries, values)
65 | osvos.train_parent(dataset, imagenet_ckpt, 3, learning_rate, logs_path, max_training_iters_3, save_step,
66 | display_step, global_step, iter_mean_grad=iter_mean_grad, resume_training=True,
67 | test_image_path=test_image, ckpt_name='OSVOS_parent')
68 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | tensorflow_gpu==1.1.0
2 | scipy==0.18.1
3 | matplotlib==1.5.3
4 | numpy==1.12.1
5 | Pillow==4.1.1
6 | tensorflow==1.1.0
7 |
--------------------------------------------------------------------------------