How to Configure the YOLO Plugin in Java

If you’re using the YOLO (You Only Look Once) plugin for your Java application, you’ll need to configure it properly to ensure it meets your requirements. In this guide, we’ll walk you through the process of configuring the YOLO plugin step by step. Let’s get started!

Step 1: Import the Required Packages

To begin, you’ll need to import the necessary packages in your Java code. Add the following import statement at the top of your file:

import net.runelite.client.config.*;

This package will provide the required classes and interfaces to configure the YOLO plugin.

Step 2: Define the YoloConfig Interface

The YoloConfig interface extends the Config interface and contains the configuration options for the YOLO plugin. Follow the code snippet below to define the YoloConfig interface:

@ConfigGroup("yolo")
public interface YoloConfig extends Config
{

Step 3: Configure the Save Path

The YOLO plugin requires a save path for the directory where it will store annotated XML files and image screenshots. To configure this save path, use the @ConfigSection annotation. Add the following code snippet to define the save path configuration option:

@ConfigSection(
			name = "Save Path",
			description = "The save path of the directory",
			position = 0
	)
	String SavePath = "SavePath";

This code snippet sets the default value for the save path to “SavePath”. You can modify this value according to your desired save path.

Step 4: Configure the Save Directory

Next, you’ll configure the save directory option, which determines the location where the YOLO plugin will save the annotated XML files and image screenshots. Use the @ConfigItem annotation to define this configuration option:

@ConfigItem(
			keyName = "saveDirectory",
			name = "Save Directory",
			description = "Configures where to save the YOLO annotated XML files and image screenshots",
			position = 0,
			section = SavePath
	)
	default String getSaveDirectory()
	{
		return "";
	}

In the above code snippet, the keyName parameter specifies the unique identifier for this configuration option. The name parameter sets the display name of the option, and the description parameter provides a brief explanation of what this option does. The position parameter determines the order in which this option appears, and the section parameter specifies the section it belongs to, which in this case is the save path section.

Step 5: Configure the Snap Image Timer

The YOLO plugin includes a snap image timer that determines the delay (in seconds) between each snapshot taken by the plugin. To configure this timer, use the @ConfigItem annotation along with the @Range annotation to define the acceptable range of values:

	@ConfigItem(
			keyName = "snapTimer",
			name = "Snap Image Timer (sec)",
			description = "The number of seconds delay in the loop for the plugin to take the next snapshot"
	)
	@Range(min = 1, max = 10)
	default int yoloSnapTimer()
	{
		return 5;
	}

In the above code snippet, the keyName, name, and description parameters have the same purpose as explained in Step 4. The @Range annotation sets the minimum and maximum values that the snap image timer can have.

Step 6: Implement Customization

Feel free to modify the default values and ranges for the configuration options according to your specific needs. You can also add additional configuration options as required, following the same pattern described in the previous steps.

Conclusion

Congratulations! You’ve successfully configured the YOLO plugin in your Java application. By following this step-by-step guide, you learned how to import the required packages, define the YoloConfig interface, and configure the necessary options such as the save path, save directory, and snap image timer.

Click this guide to using the YOLO plugin: How to Use the Yolo Extracts Plugin for RuneLite

For coding the YOLO Plugin please check out: How The Code Works: Yolo Extracts Plugin

Now you can take advantage of the YOLO plugin’s features to enhance your application’s image processing capabilities. Happy coding!

One thought on “How to Configure the YOLO Plugin in Java

Leave a Reply

Your email address will not be published. Required fields are marked *