Skip to content

Commit

Permalink
Improve docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Kalior committed Aug 31, 2018
1 parent 38d9c64 commit 7827455
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 17 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Most of what the scripts do is to wrap input and output to the different modules
3. Fill-in missing keypoints (as OpenPose sometimes does not output every keypoint) by maintaining the same distance to a connected keypoint (e.g. wirst-elbow) as when the keypoint was last seen. This increases the accuracy of the classifier later on.
4. Fill-in missing frames by interpolating positions of every keypoint. This is done to normalise the data in case OpenPose lost track of a person for a couple of frames. With this normalisation, every chunk of the same length will also have the same length in video-time.
* If there are multiple datasets that you wish to combine, you can run the [`combine_datasets.py`](combine_datasets.py) script which allows you to do exactly that.
* A possible improvement here is to allow a user to label different chunks in the same video with different lengths.

#### visualise_dataset.py

Expand Down
9 changes: 4 additions & 5 deletions action_recognition/analysis/labelling.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,21 +163,20 @@ def pseudo_automatic_labelling(self, timestamps, frames_per_chunk, video, tracks
Returns
-------
chunks : numpy.array
The labelled chunks
The labelled chunks.
frames : numpy.array
The frames for the labelled chunks
The frames for the labelled chunks.
labels : numpy.array
The labels for each chunk
The labels for each chunk.
indicies : numpy.array
The index of the track for every chunk.
needed for reproducibility.
Needed for reproducibility.
"""
keypoints = tracks[0][0].keypoints
chunk_shape = (frames_per_chunk, *keypoints.shape)
chunks, frames, labels, track_indicies = self._init_arrays(chunk_shape, frames_per_chunk)

for timestamp in timestamps:
# Only include the first track that fits the timestamp
for i, track in enumerate(tracks):
track_arrays = self._pseudo_automatic_labelling(
timestamp, track, i, frames_per_chunk, chunk_shape, video)
Expand Down
29 changes: 18 additions & 11 deletions action_recognition/classifiers/classification_visualiser.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@ def plot_confusion_matrix(self, labels, test_labels, class_names, title):
Parameters
----------
labels : array-like of predicted labels
test_labels : array-like of ground truth labels
class_names : array-like of class names.
title : str, title of the plot and name of the file
labels : array-like
Predicted labels from the classifier.
test_labels : array-like
Ground truth labels.
class_names : array-like
The names of the classes in the data.
title : str
Title of the plot and name of the file.
"""
confusion_matrix = metrics.confusion_matrix(test_labels, labels).astype(np.float32)
Expand All @@ -47,13 +51,16 @@ def visualise_incorrect_classifications(self, pred_labels, test_labels, chunks,
Parameters
----------
pred_labels : array-like of predicted labels.
test_labels : array-like of ground truth labels.
chunks : array-like, the corresponding chunks for the labels.
frames : array-like, the frames for the chunks.
translated_chuns : array-like
the chunks with transforms.TranslateChunks() applied
videos : array-like, the paths to the corresponding videos of the chunks.
pred_labels : array-like
Predicted labels from the classifier.
test_labels : array-like
Ground truth labels.
chunks : array-like
The corresponding chunks for the labels.
frames : array-like
The frame numbers for the chunks.
videos : array-like
The paths to the corresponding videos of the chunks.
"""
visualiser = ChunkVisualiser(chunks, frames, translated_chunks)
Expand Down
2 changes: 1 addition & 1 deletion create_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def process_tracks(tracks_file, video, target_frames_per_chunk, overlap_percenta
np_tracks = tracks_npz['tracks']
np_frames = tracks_npz['frames']

logging.info("Combining, cleaning and removing tracks.")
logging.info("Combining, cleaning, and removing tracks.")
processor = PostProcessor()
processor.create_tracks(np_tracks, np_frames)
processor.post_process_tracks()
Expand Down

0 comments on commit 7827455

Please sign in to comment.