The mseg Terminal Tool

MSeg ships with the mseg terminal tool, which:

  • Controls the MSeg core module
  • Helps setting up new motion segmentation algorithm projects


You can run <command> --help at any time to get a quick overview on the usage and synopsis. If you need more detail for a given subcommand, you can run <command> <subcommand> --help instead. The usage of the tools may change with future versions of MSeg. If the information on this page is contradicting the information given from the --help, always rely on that help.

Control the MSeg Core Module

With mseg, the MSeg core module can be controlled.

Available subcommands

  • status: Prints the status of the MSeg core module processes
  • start: Start the MSeg core module processes
  • stop: Stop the MSeg core module processes
  • restart: Stop and start the MSeg core module processes

If an unexpected error leads to the crash of one or more processes, you will need to restart the MSeg core module using mseg restart. A crash can be diagnosed if mseg status indicates that the status of the MSeg core module is either “mixed” or “stopped”.


The MSeg core module cannot start properly if ArmarX is not running. You can query the status of ArmarX by running armarx status, and you can start it by running armarx start.

Helper for Setting Up New Projects

The mseg generate command is a helper tool to kick-start a new motion segmentation algorithm project. It creates all source files (and build files, if appropriate) needed for a given programming language with well-commented stubs and dummy-implementations.


mseg generate [--train] (--cpp | --python | --java | --matlab) <base-path> <project-name>

  • The flag --train is optional. If set, the code will be included to use the train API. If not set, those parts will be commented out
  • The flags --cpp, --python, --java and --matlab are mutually exclusive. Exactly one of them must be set
  • <base-path> is the base directory in which the project directory should be created
  • <project-name> is the name of the project, respectively the motion segmentation algorithm. It must me alphanumeric and start with a character


  • To implement the PCA approach by Barbič in the home directory and in Java, the usage would be: mseg generate --java ~ PCABarbic
  • To implement a machine learning algorithm in Python, located in ~/projects: mseg generate --train --java ~/projects MLApproach