transfer learn without losing old memoy YoloX

Hi,
I have learned to perform transfer learning on yoloX object detector....However my new data is only based on "person" class (with person climbing a wall).
[imds,blds] = objectDetectorTrainingData(gTruth);
classes = categories(blds.LabelData{1,2});
>>classes 1x1 cell array {'person'}
detector=yoloxObjectDetector("small-coco",classes,"InputSize",targetDataSize);
detector = trainYOLOXObjectDetector(trainingData,detector,options);
When i train trainYOLOXObjectDetector() on this new data, it fits the model to detect only new data type but "person" images recognized by original yoloX model are no longer detected.... How can i perform transfer learning in this scenario.
When i keep classes equal to yoloX 80 classes, and train model on new data, it says class sizes are mismatch.
I don't want to train on mix data data (coco images + new data) as it will be tedious...
How can i pass new data while maintaining detection capability of original yoloX...
Thanks

 Accepted Answer

Matt J
Matt J on 7 May 2026 at 16:24
Edited: Matt J on 7 May 2026 at 19:14
Continual learning is a serious research topic.There are no off-the-shelf tools in Matlab to do it in a sophisticated way. You would probably have to use a lower level training routine like trainnet or possibly a custom training loop. This paper might also be relevant:

4 Comments

tren
tren on 7 May 2026 at 18:07
Edited: tren on 7 May 2026 at 18:09
Ok this means that best i can do is to find an appropriate dataset and and mix my data with it and train, rite....?
my images contain small sized humans detected in very low resolution and vegetation by cctv... Basically person climbing walls/area (captured from 50-100m by cctv camera)
can someone suggest any good dataset,please?
thanks
Matt J
Matt J on 7 May 2026 at 18:40
Edited: Matt J on 7 May 2026 at 19:04
You obviously have at least a few examples of the old data type because you've reported to us that they aren't correctly processed with the new yoloX, right? One thing you can try is to make replicas of the few that you have and intersperse them throughout your new data set. If you make enough replicas so that every minibatch contains a few of the old types during training, each gradient step will be hindered from forgetting at least those examples. It might be enough of a regularizing force that the small data set you have will be enough.
tren
tren on 7 May 2026 at 19:05
Moved: Matt J on 7 May 2026 at 19:06
is there a provision of downloading train dataset through Matlab... I am looking to download images with cctv small human detection type to match my data///
Matt J
Matt J on 7 May 2026 at 19:09
Edited: Matt J on 7 May 2026 at 19:10
From ChatGPT:
---------------------------
MATLAB provides helper functions for downloading some standard computer vision datasets (for example COCO, VOC, Caltech Pedestrian in some examples, etc.), but there is not a built-in MATLAB command that automatically downloads a specialized CCTV small-human dataset matched to your application.
For CCTV-style small-person detection, people commonly use datasets such as:
  • CrowdHuman
  • WiderPerson
  • VisDrone
  • TinyPerson
  • Caltech Pedestrian Dataset
These are usually downloaded manually from the dataset website, then imported into MATLAB using:
imageDatastore
boxLabelDatastore
combine
If your targets are very small (typical CCTV wide-angle scenes), datasets like TinyPerson or VisDrone are often more representative than generic COCO pedestrians.
MATLAB examples sometimes include helper scripts such as:
helper.downloadDataset(...)
but those helpers are example-specific and not a general dataset repository service.
Also note that for YOLOX or YOLOv8-style training, matching:
  • camera height,
  • viewing angle,
  • compression artifacts,
  • night/day conditions,
  • and target pixel size
often matters more than sheer dataset size. Generic pedestrian datasets can perform poorly on tiny CCTV humans unless fine-tuned on domain-matched imagery

Sign in to comment.

More Answers (0)

Products

Release

R2025b

Asked:

on 7 May 2026 at 15:34

Edited:

on 7 May 2026 at 19:14

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!