Skip to content

Commit 19e60dc

Browse files
Python 2 -> 3 migration (#8525)
* Changed DELF installation instructions to be Python3 preferred * Changed DELF landmark detection instructions to be Python3 preferred * Changed DELF extraction and matching instructions to be Python3 preferred * Changed DELF detect-to-retrieve instructions to be Python3 preferred * Changed DELF training instructions to be Python3 preferred * Added Python3 badge to DELF README
1 parent e81d423 commit 19e60dc

File tree

6 files changed

+24
-29
lines changed

6 files changed

+24
-29
lines changed

research/delf/DETECTION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ threshold of 0.8, and produce visualizations.
4444

4545
```bash
4646
# From tensorflow/models/research/delf/delf/python/examples/
47-
python extract_boxes.py \
47+
python3 extract_boxes.py \
4848
--detector_path parameters/d2r_frcnn_20190411 \
4949
--detector_thresh 0.8 \
5050
--list_images_path list_images_detector.txt \

research/delf/EXTRACTION_MATCHING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ features for the images `hertford_000056.jpg` and `oxford_000317.jpg`:
4444

4545
```bash
4646
# From tensorflow/models/research/delf/delf/python/examples/
47-
python extract_features.py \
47+
python3 extract_features.py \
4848
--config_path delf_config_example.pbtxt \
4949
--list_images_path list_images.txt \
5050
--output_dir data/oxford5k_features
@@ -56,7 +56,7 @@ After feature extraction, run this command to perform feature matching between
5656
the images `hertford_000056.jpg` and `oxford_000317.jpg`:
5757

5858
```bash
59-
python match_images.py \
59+
python3 match_images.py \
6060
--image_1_path data/oxford5k_images/hertford_000056.jpg \
6161
--image_2_path data/oxford5k_images/oxford_000317.jpg \
6262
--features_1_path data/oxford5k_features/hertford_000056.delf \
@@ -84,4 +84,4 @@ By default, skimage 0.13.XX or 0.14.1 is installed if you followed the
8484
instructions. According to
8585
[https://github.com/scikit-image/scikit-image/issues/3649#issuecomment-455273659]
8686
If you have scikit-image related issues, upgrading to a version above 0.14.1
87-
with `pip install -U scikit-image` should fix the issue
87+
with `pip3 install -U scikit-image` should fix the issue

research/delf/INSTALL_INSTRUCTIONS.md

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@
33
### Tensorflow
44

55
[![TensorFlow 2.1](https://img.shields.io/badge/tensorflow-2.1-brightgreen)](https://github.com/tensorflow/tensorflow/releases/tag/v2.1.0)
6+
[![Python 3.6](https://img.shields.io/badge/python-3.6-blue.svg)](https://www.python.org/downloads/release/python-360/)
67

78
For detailed steps to install Tensorflow, follow the
89
[Tensorflow installation instructions](https://www.tensorflow.org/install/). A
910
typical user can install Tensorflow using one of the following commands:
1011

1112
```bash
1213
# For CPU:
13-
pip install 'tensorflow'
14+
pip3 install 'tensorflow'
1415
# For GPU:
15-
pip install 'tensorflow-gpu'
16+
pip3 install 'tensorflow-gpu'
1617
```
1718

1819
### TF-Slim
@@ -23,7 +24,7 @@ using previous versions which relied on tf.contrib (which is now deprecated).
2324
```bash
2425
git clone git@github.com:google-research/tf-slim.git
2526
cd tf-slim
26-
pip install .
27+
pip3 install .
2728
```
2829

2930
Note that these commands assume you are cloning using SSH. If you are using
@@ -51,8 +52,8 @@ PATH_TO_PROTOC=`pwd`
5152
Install python library dependencies:
5253

5354
```bash
54-
pip install matplotlib numpy scikit-image scipy
55-
sudo apt-get install python-tk
55+
pip3 install matplotlib numpy scikit-image scipy
56+
sudo apt-get install python3-tk
5657
```
5758

5859
### `tensorflow/models`
@@ -90,32 +91,25 @@ under the hood.
9091

9192
```bash
9293
# From tensorflow/models/research/delf/
93-
pip install -e . # Install "delf" package.
94+
pip3 install -e . # Install "delf" package.
9495
```
9596

9697
At this point, running
9798

9899
```bash
99-
python -c 'import delf'
100+
python3 -c 'import delf'
100101
```
101102

102103
should just return without complaints. This indicates that the DELF package is
103104
loaded successfully.
104105

105106
### Troubleshooting
106107

107-
#### Python version
108+
#### `pip3 install`
108109

109-
Installation issues may happen if multiple python versions are mixed. The
110-
instructions above assume python2.7 version is used; if using python3.X, be sure
111-
to use `pip3` instead of `pip`, `python3-tk` instead of `python-tk`, and all
112-
should work.
113-
114-
#### `pip install`
115-
116-
Issues might be observed if using `pip install` with `-e` option (editable
110+
Issues might be observed if using `pip3 install` with `-e` option (editable
117111
mode). You may try out to simply remove the `-e` from the commands above. Also,
118-
depending on your machine setup, you might need to run the `sudo pip install`
112+
depending on your machine setup, you might need to run the `sudo pip3 install`
119113
command, that is with a `sudo` at the beginning.
120114

121115
#### Cloning github repositories

research/delf/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# DELF: DEep Local Features
22

33
[![TensorFlow 2.1](https://img.shields.io/badge/tensorflow-2.1-brightgreen)](https://github.com/tensorflow/tensorflow/releases/tag/v2.1.0)
4+
[![Python 3.6](https://img.shields.io/badge/python-3.6-blue.svg)](https://www.python.org/downloads/release/python-360/)
45

56
This project presents code for extracting DELF features, which were introduced
67
with the paper

research/delf/delf/python/detect_to_retrieve/DETECT_TO_RETRIEVE_INSTRUCTIONS.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Query feature extraction can be run as follows:
8787

8888
```bash
8989
# From models/research/delf/delf/python/detect_to_retrieve
90-
python extract_query_features.py \
90+
python3 extract_query_features.py \
9191
--delf_config_path delf_gld_config.pbtxt \
9292
--dataset_file_path ~/detect_to_retrieve/data/gnd_roxford5k.mat \
9393
--images_dir ~/detect_to_retrieve/data/oxford5k_images \
@@ -100,7 +100,7 @@ Index feature extraction / box detection can be run as follows:
100100

101101
```bash
102102
# From models/research/delf/delf/python/detect_to_retrieve
103-
python extract_index_boxes_and_features.py \
103+
python3 extract_index_boxes_and_features.py \
104104
--delf_config_path delf_gld_config.pbtxt \
105105
--detector_model_dir parameters/d2r_frcnn_20190411 \
106106
--detector_thresh 0.1 \
@@ -125,7 +125,7 @@ Run query feature aggregation as follows:
125125

126126
```bash
127127
# From models/research/delf/delf/python/detect_to_retrieve
128-
python extract_aggregation.py \
128+
python3 extract_aggregation.py \
129129
--use_query_images True \
130130
--aggregation_config_path query_aggregation_config.pbtxt \
131131
--dataset_file_path ~/detect_to_retrieve/data/gnd_roxford5k.mat \
@@ -139,7 +139,7 @@ Run index feature aggregation as follows:
139139

140140
```bash
141141
# From models/research/delf/delf/python/detect_to_retrieve
142-
python extract_aggregation.py \
142+
python3 extract_aggregation.py \
143143
--aggregation_config_path index_aggregation_config.pbtxt \
144144
--dataset_file_path ~/detect_to_retrieve/data/gnd_roxford5k.mat \
145145
--features_dir ~/detect_to_retrieve/data/oxford5k_features/index_0.1 \
@@ -156,7 +156,7 @@ To run retrieval on `roxford5k`, the following command can be used:
156156

157157
```bash
158158
# From models/research/delf/delf/python/detect_to_retrieve
159-
python perform_retrieval.py \
159+
python3 perform_retrieval.py \
160160
--index_aggregation_config_path index_aggregation_config.pbtxt \
161161
--query_aggregation_config_path query_aggregation_config.pbtxt \
162162
--dataset_file_path ~/detect_to_retrieve/data/gnd_roxford5k.mat \
@@ -193,7 +193,7 @@ example command:
193193

194194
```bash
195195
# From models/research/delf/delf/python/detect_to_retrieve
196-
python perform_retrieval.py \
196+
python3 perform_retrieval.py \
197197
--index_aggregation_config_path index_aggregation_config.pbtxt \
198198
--query_aggregation_config_path query_aggregation_config.pbtxt \
199199
--dataset_file_path ~/detect_to_retrieve/data/gnd_roxford5k.mat \
@@ -215,7 +215,7 @@ K-means are not registered for GPU usage in Tensorflow.
215215

216216
```bash
217217
# From models/research/delf/delf/python/detect_to_retrieve
218-
python cluster_delf_features.py \
218+
python3 cluster_delf_features.py \
219219
--dataset_file_path ~/detect_to_retrieve/data/gnd_rparis6k.mat \
220220
--features_dir ~/detect_to_retrieve/data/paris6k_features/index_0.1 \
221221
--num_clusters 1024 \

research/delf/delf/python/training/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Assuming the data was downloaded to `/tmp/gld_tfrecord/`, running the following
1313
command should start training a model:
1414

1515
```sh
16-
python tensorflow_models/research/delf/delf/python/training/train.py \
16+
python3 tensorflow_models/research/delf/delf/python/training/train.py \
1717
--train_file_pattern=/tmp/gld_tfrecord/train* \
1818
--validation_file_pattern=/tmp/gld_tfrecord/train* \
1919
--debug

0 commit comments

Comments
 (0)